gitee.com/h79/goutils@v1.22.10/dao/wrapper/wrapper.go (about) 1 package wrapper 2 3 import ( 4 commonoption "gitee.com/h79/goutils/common/option" 5 "reflect" 6 ) 7 8 var BuilderType = reflect.TypeOf((*IBuilder)(nil)).Elem() 9 10 type IBuilder interface { 11 Is() bool 12 Build(opts ...commonoption.Option) string 13 } 14 15 var FromType = reflect.TypeOf((*IFrom)(nil)).Elem() 16 17 type IFrom interface { 18 SetAs(as string) 19 IBuilder 20 } 21 22 var LimitType = reflect.TypeOf((*ILimit)(nil)).Elem() 23 24 type ILimit interface { 25 GetLimit() int 26 GetOffset() int 27 IBuilder 28 } 29 30 var QueryType = reflect.TypeOf((*IQuery)(nil)).Elem() 31 32 type IQuery interface { 33 Query() string 34 Value() []interface{} 35 IBuilder 36 } 37 38 var SelectType = reflect.TypeOf((*ISelect)(nil)).Elem() 39 40 type ISelect interface { 41 Query() []string 42 Value() []interface{} 43 IBuilder 44 } 45 46 var CondType = reflect.TypeOf((*ICond)(nil)).Elem() 47 48 type ICond interface { 49 HasValid() error 50 Decode(cond string) 51 BuildCond(cond *Condition) 52 Build(key string, cb func(obj interface{})) error 53 } 54 55 var ModelType = reflect.TypeOf((*IModel)(nil)).Elem() 56 57 type IModel interface { 58 Clone() IModel 59 Model() interface{} 60 Set(key string, v interface{}) 61 Get(key string) interface{} 62 ForEach(cb func(key string, v interface{})) 63 } 64 65 type NewCondFunc func() ICond 66 type NewModelFunc func() IModel