Added a SQL-Preprocessor - this way we can unmarshal recursive structures (LEFT JOIN etc)

This commit is contained in:
2022-12-21 18:14:13 +01:00
parent bbf7962e29
commit dbc014f819
19 changed files with 740 additions and 162 deletions

View File

@@ -2,6 +2,7 @@ package util
import (
"fmt"
"github.com/gin-gonic/gin"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"reflect"
"runtime/debug"
@@ -199,3 +200,22 @@ func AssertMultiNonEmpty(t *testing.T, key string, args ...any) {
}
}
}
func AssertMappedSet[T langext.OrderedConstraint](t *testing.T, key string, expected []T, values []gin.H, objkey string) {
actual := langext.ArrMap(values, func(v gin.H) T { return v[objkey].(T) })
langext.Sort(actual)
langext.Sort(expected)
if !langext.ArrEqualsExact(actual, expected) {
t.Errorf("Value [%s] differs (%T <-> %T):\n", key, expected, actual)
t.Errorf("Actual := [%v]\n", actual)
t.Errorf("Expected := [%v]\n", expected)
t.Error(string(debug.Stack()))
t.FailNow()
}
}