package sdbc import ( "reflect" "google.golang.org/protobuf/proto" ) // model props for protobuf Message type model struct { Type proto.Message // model prototype modelKind reflect.Type // model low level type modelName string // model struct name tableName string // model mapping table name } // ptr 基于类型获取实例指针 func (m *model) ptr() any { return reflect.New(m.modelKind).Interface() } type scope struct { *model *sdbc } func (s *scope) Insert() *_insert { return &_insert{ scope: s, sdbc: s.sdbc, } } func (s *scope) Find() *_find { return &_find{ scope: s, sdbc: s.sdbc, } } func (s *scope) Update() *_update { return &_update{ scope: s, sdbc: s.sdbc, } } func (s *scope) Delete() *_delete { return &_delete{ scope: s, sdbc: s.sdbc, } } type Operator interface { Insert() *_insert Find() *_find Update() *_update Delete() *_delete }