Added a SQL-Preprocessor - this way we can unmarshal recursive structures (LEFT JOIN etc)
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user