github.com/aacfactory/fns-contrib/databases/sql@v1.2.84/dac/conditions.go (about) 1 package dac 2 3 import ( 4 "database/sql" 5 "github.com/aacfactory/fns-contrib/databases/sql/dac/conditions" 6 "time" 7 ) 8 9 func Eq(field string, expression any) conditions.Condition { 10 return conditions.New(conditions.Eq(field, expression)) 11 } 12 13 func NotEq(field string, expression any) conditions.Condition { 14 return conditions.New(conditions.NotEq(field, expression)) 15 } 16 17 func Gt(field string, expression any) conditions.Condition { 18 return conditions.New(conditions.Gt(field, expression)) 19 } 20 21 func Gte(field string, expression any) conditions.Condition { 22 return conditions.New(conditions.Gte(field, expression)) 23 } 24 25 func Lt(field string, expression any) conditions.Condition { 26 return conditions.New(conditions.Lt(field, expression)) 27 } 28 29 func Lte(field string, expression any) conditions.Condition { 30 return conditions.New(conditions.Lte(field, expression)) 31 } 32 33 func Between(field string, left any, right any) conditions.Condition { 34 return conditions.New(conditions.Between(field, left, right)) 35 } 36 37 func In(field string, expression ...any) conditions.Condition { 38 return conditions.New(conditions.In(field, expression...)) 39 } 40 41 func NotIn(field string, expression ...any) conditions.Condition { 42 return conditions.New(conditions.NotIn(field, expression...)) 43 } 44 45 func Like(field string, expression string) conditions.Condition { 46 return conditions.New(conditions.Like(field, expression)) 47 } 48 49 func LikeLast(field string, expression string) conditions.Condition { 50 return conditions.New(conditions.LikeLast(field, expression)) 51 } 52 53 func LikeContains(field string, expression string) conditions.Condition { 54 return conditions.New(conditions.LikeContains(field, expression)) 55 } 56 57 func SubQuery(query any, field string, cond conditions.Condition) conditions.QueryExpr { 58 return conditions.Query(query, field, cond) 59 } 60 61 func LitSubQuery(query string) conditions.QueryExpr { 62 return conditions.LitQuery(query) 63 } 64 65 func String(s string) conditions.Literal { 66 return conditions.String(s) 67 } 68 69 func Bool(b bool) conditions.Literal { 70 return conditions.Bool(b) 71 } 72 73 func Int(n int) conditions.Literal { 74 return conditions.Int(n) 75 } 76 77 func Int64(n int64) conditions.Literal { 78 return conditions.Int64(n) 79 } 80 81 func Float(f float32) conditions.Literal { 82 return conditions.Float(f) 83 } 84 85 func Float64(f float64) conditions.Literal { 86 return conditions.Float64(f) 87 } 88 89 func Time(t time.Time) conditions.Literal { 90 return conditions.Datetime(t) 91 } 92 93 func Lit(v string) conditions.Literal { 94 return conditions.Lit(v) 95 } 96 97 func Named(name string, value any) sql.NamedArg { 98 return sql.Named(name, value) 99 }