mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: use new sql predicates to reduce codegen size (#3179)
This commit is contained in:
@@ -74,16 +74,20 @@ func NotContaining(substr string) *dsl.Traversal {
|
||||
}
|
||||
|
||||
// Within Determines if a value is within the specified list of values.
|
||||
func Within(args ...any) *dsl.Traversal {
|
||||
func Within[T any](args ...T) *dsl.Traversal {
|
||||
return op("within", args...)
|
||||
}
|
||||
|
||||
// Without determines if a value is not within the specified list of values.
|
||||
func Without(args ...any) *dsl.Traversal {
|
||||
func Without[T any](args ...T) *dsl.Traversal {
|
||||
return op("without", args...)
|
||||
}
|
||||
|
||||
func op(name string, args ...any) *dsl.Traversal {
|
||||
func op[T any](name string, args ...T) *dsl.Traversal {
|
||||
t := &dsl.Traversal{}
|
||||
return t.Add(dsl.NewFunc(name, args...))
|
||||
vs := make([]any, len(args))
|
||||
for i, arg := range args {
|
||||
vs[i] = arg
|
||||
}
|
||||
return t.Add(dsl.NewFunc(name, vs...))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user