Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetObjectID ¶
Types ¶
type Collection ¶
type Collection interface {
GetC() string
}
type DocInter ¶
type DocInter interface {
Collection
GetDoc() interface{}
GetID() interface{}
SetCreator(u LogUser)
AddRecord(u LogUser, msg string) []*Record
GetIndexes() []mongo.IndexModel
}
type MgoAggregate ¶
type MgoAggregate interface {
GetPipeline(q bson.M) mongo.Pipeline
Collection
}
type MgoDBModel ¶
type MgoDBModel interface {
DisableCheckBeforeSave(b bool)
SetDB(db *mongo.Database)
BatchUpdate(doclist []DocInter, getField func(d DocInter) bson.D, u LogUser) (failed []DocInter, err error)
BatchSave(doclist []DocInter, u LogUser) (inserted []interface{}, failed []DocInter, err error)
Save(d DocInter, u LogUser) (interface{}, error)
RemoveAll(d DocInter, q primitive.M, u LogUser) (int64, error)
RemoveByID(d DocInter, u LogUser) (int64, error)
UpdateOne(d DocInter, fields bson.D, u LogUser) (int64, error)
UpdateAll(d DocInter, q bson.M, fields bson.D, u LogUser) (int64, error)
UnsetFields(d DocInter, q bson.M, fields []string, u LogUser) (int64, error)
Upsert(d DocInter, u LogUser) (interface{}, error)
FindByID(d DocInter) error
FindOne(d DocInter, q bson.M, option ...*options.FindOneOptions) error
Find(d DocInter, q bson.M, option ...*options.FindOptions) (interface{}, error)
FindAndExec(
d DocInter, q bson.M,
exec func(i interface{}) error,
opts ...*options.FindOptions,
) error
PipeFindOne(aggr MgoAggregate, filter bson.M) error
PipeFind(aggr MgoAggregate, filter bson.M, opts ...*options.AggregateOptions) (interface{}, error)
PipeFindAndExec(
aggr MgoAggregate, q bson.M,
exec func(i interface{}) error,
opts ...*options.AggregateOptions,
) error
PagePipeFind(aggr MgoAggregate, filter bson.M, sort bson.M, limit, page int64) (interface{}, error)
PageFind(d DocInter, q bson.M, limit, page int64, opts ...*options.FindOptions) (interface{}, error)
CountDocuments(d Collection, q bson.M) (int64, error)
GetPaginationSource(d DocInter, q bson.M, opts ...*options.FindOptions) format.PaginationSource
GetPipePaginationSource(aggr MgoAggregate, q bson.M, sort bson.M) format.PaginationSource
CreateCollection(dlist ...DocInter) error
//Reference to customer code, use for aggregate pagination
CountAggrDocuments(aggr MgoAggregate, q bson.M) (int64, error)
GetPipeMatchPaginationSource(aggr MgoAggregate, q bson.M, sort bson.M) format.PaginationSource
NewFindMgoDS(d DocInter, q bson.M, opts ...*options.FindOptions) MgoDS
NewPipeFindMgoDS(d MgoAggregate, q bson.M, opts ...*options.AggregateOptions) MgoDS
}
func NewMgoModel ¶
func NewMgoModel(ctx context.Context, db *mongo.Database) MgoDBModel
func NewMgoModelByReq ¶
func NewMgoModelByReq(req *http.Request) MgoDBModel
Source Files
¶
Click to show internal directories.
Click to hide internal directories.