88 lines
1.1 KiB
Go
88 lines
1.1 KiB
Go
package mdbc
|
|
|
|
import (
|
|
"google.golang.org/protobuf/proto"
|
|
"reflect"
|
|
)
|
|
|
|
// 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
|
|
}
|
|
|
|
// Scope export operation for user
|
|
type scope struct {
|
|
*model
|
|
*mdbc
|
|
}
|
|
|
|
type Collection interface {
|
|
Aggregate()
|
|
BulkWrite()
|
|
Clone()
|
|
Count() *countScope
|
|
Delete()
|
|
Find()
|
|
Drop() *dropScope
|
|
Indexes() *indexesScope
|
|
Insert()
|
|
Update()
|
|
Watch()
|
|
}
|
|
|
|
// Aggregate aggregate operate for mongo
|
|
func (s *scope) Aggregate() {
|
|
|
|
}
|
|
|
|
func (s *scope) BulkWrite() {
|
|
|
|
}
|
|
|
|
func (s *scope) Clone() {
|
|
|
|
}
|
|
|
|
func (s *scope) Count() *countScope {
|
|
return &countScope{
|
|
scope: s,
|
|
mdbc: s.mdbc,
|
|
}
|
|
}
|
|
|
|
func (s *scope) Delete() {
|
|
|
|
}
|
|
|
|
func (s *scope) Find() {
|
|
|
|
}
|
|
|
|
func (s *scope) Drop() *dropScope {
|
|
return &dropScope{
|
|
scope: s,
|
|
mdbc: s.mdbc,
|
|
}
|
|
}
|
|
|
|
func (s *scope) Indexes() *indexesScope {
|
|
return &indexesScope{
|
|
scope: s,
|
|
mdbc: s.mdbc,
|
|
}
|
|
}
|
|
|
|
func (s *scope) Insert() {
|
|
|
|
}
|
|
|
|
func (s *scope) Update() {
|
|
|
|
}
|
|
func (s *scope) Watch() {
|
|
|
|
}
|