Documentation ¶
Index ¶
- Variables
- func Aggregate(sqltable core.SqlTable, pipeline interface{}, ...) (*mongo.Cursor, error)
- func Close() (err error)
- func Collection(sqltable core.SqlTable) *mongo.Collection
- func CountDocuments(sqltable core.SqlTable, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func CountDocumentsByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (int64, error)
- func CreateIndex(sqltable core.SqlTable, model mongo.IndexModel, ...) (string, error)
- func DeleteIndex(sqltable core.SqlTable, name string, opts ...*options.DropIndexesOptions) (bson.Raw, error)
- func DeleteMany(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func DeleteManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (*mongo.DeleteResult, error)
- func DeleteOne(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func Find(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func FindByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (*mongo.Cursor, error)
- func FindOne(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func FindOneAndDelete(sqltable core.SqlTable, filter interface{}, ...) *mongo.SingleResult
- func FindOneAndUpdate(sqltable core.SqlTable, filter interface{}, update interface{}, ...) *mongo.SingleResult
- func InsertMany(sqltable core.SqlTable, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func InsertManyByCtx(sqltable core.SqlTable, ctx context.Context, data []interface{}, ...) (*mongo.InsertManyResult, error)
- func InsertOne(sqltable core.SqlTable, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func ListCollectionNames(filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error)
- func OnInit(config map[string]interface{}, option ...Option) (err error)
- func UpdateMany(sqltable core.SqlTable, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func UpdateManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (*mongo.UpdateResult, error)
- func UpdateOne(sqltable core.SqlTable, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func UseSession(fn func(sessionContext mongo.SessionContext) error) error
- type IMongodb
- type Mongodb
- func (this *Mongodb) Aggregate(sqltable core.SqlTable, pipeline interface{}, ...) (*mongo.Cursor, error)
- func (this *Mongodb) Close() (err error)
- func (this *Mongodb) Collection(sqltable core.SqlTable) *mongo.Collection
- func (this *Mongodb) CountDocuments(sqltable core.SqlTable, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (this *Mongodb) CountDocumentsByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (int64, error)
- func (this *Mongodb) CreateIndex(sqltable core.SqlTable, model mongo.IndexModel, ...) (string, error)
- func (this *Mongodb) DeleteIndex(sqltable core.SqlTable, name string, opts ...*options.DropIndexesOptions) (bson.Raw, error)
- func (this *Mongodb) DeleteMany(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (this *Mongodb) DeleteManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (*mongo.DeleteResult, error)
- func (this *Mongodb) DeleteOne(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (this *Mongodb) Find(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func (this *Mongodb) FindByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (*mongo.Cursor, error)
- func (this *Mongodb) FindOne(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func (this *Mongodb) FindOneAndDelete(sqltable core.SqlTable, filter interface{}, ...) *mongo.SingleResult
- func (this *Mongodb) FindOneAndUpdate(sqltable core.SqlTable, filter interface{}, update interface{}, ...) *mongo.SingleResult
- func (this *Mongodb) InsertMany(sqltable core.SqlTable, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func (this *Mongodb) InsertManyByCtx(sqltable core.SqlTable, ctx context.Context, data []interface{}, ...) (*mongo.InsertManyResult, error)
- func (this *Mongodb) InsertOne(sqltable core.SqlTable, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (this *Mongodb) ListCollectionNames(filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error)
- func (this *Mongodb) UpdateMany(sqltable core.SqlTable, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func (this *Mongodb) UpdateManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (this *Mongodb) UpdateOne(sqltable core.SqlTable, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func (this *Mongodb) UseSession(fn func(sessionContext mongo.SessionContext) error) error
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MongodbNil = mongo.ErrNoDocuments //数据为空错误
)
Functions ¶
func Collection ¶
func Collection(sqltable core.SqlTable) *mongo.Collection
func CountDocuments ¶
func CountDocumentsByCtx ¶
func CreateIndex ¶
func CreateIndex(sqltable core.SqlTable, model mongo.IndexModel, opts ...*options.CreateIndexesOptions) (string, error)
func DeleteIndex ¶
func DeleteMany ¶
func DeleteMany(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func DeleteManyByCtx ¶
func DeleteManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func DeleteOne ¶
func DeleteOne(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func FindOne ¶
func FindOne(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
func FindOneAndDelete ¶
func FindOneAndDelete(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
func FindOneAndUpdate ¶
func FindOneAndUpdate(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult
func InsertMany ¶
func InsertMany(sqltable core.SqlTable, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func InsertManyByCtx ¶
func InsertManyByCtx(sqltable core.SqlTable, ctx context.Context, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func InsertOne ¶
func InsertOne(sqltable core.SqlTable, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
func ListCollectionNames ¶
func ListCollectionNames(filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error)
func UpdateMany ¶
func UpdateMany(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UpdateManyByCtx ¶
func UpdateManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UpdateOne ¶
func UpdateOne(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UseSession ¶
func UseSession(fn func(sessionContext mongo.SessionContext) error) error
Types ¶
type IMongodb ¶
type IMongodb interface { Close() (err error) ListCollectionNames(filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error) Collection(sqltable core.SqlTable) *mongo.Collection CreateIndex(sqltable core.SqlTable, model mongo.IndexModel, opts ...*options.CreateIndexesOptions) (string, error) DeleteIndex(sqltable core.SqlTable, name string, opts ...*options.DropIndexesOptions) (bson.Raw, error) UseSession(fn func(sessionContext mongo.SessionContext) error) error CountDocuments(sqltable core.SqlTable, filter interface{}, opts ...*options.CountOptions) (int64, error) CountDocumentsByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) Find(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error) FindByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error) FindOne(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult FindOneAndUpdate(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult InsertOne(sqltable core.SqlTable, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error) InsertMany(sqltable core.SqlTable, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error) InsertManyByCtx(sqltable core.SqlTable, ctx context.Context, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error) UpdateOne(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) UpdateMany(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) UpdateManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) FindOneAndDelete(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult DeleteOne(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) DeleteMany(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) DeleteManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Aggregate(sqltable core.SqlTable, pipeline interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error) }
type Mongodb ¶
type Mongodb struct { Client *mongo.Client Database *mongo.Database // contains filtered or unexported fields }
func (*Mongodb) Collection ¶
func (this *Mongodb) Collection(sqltable core.SqlTable) *mongo.Collection
func (*Mongodb) CountDocuments ¶
func (*Mongodb) CountDocumentsByCtx ¶
func (*Mongodb) CreateIndex ¶
func (this *Mongodb) CreateIndex(sqltable core.SqlTable, model mongo.IndexModel, opts ...*options.CreateIndexesOptions) (string, error)
func (*Mongodb) DeleteIndex ¶
func (*Mongodb) DeleteMany ¶
func (this *Mongodb) DeleteMany(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*Mongodb) DeleteManyByCtx ¶
func (this *Mongodb) DeleteManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*Mongodb) DeleteOne ¶
func (this *Mongodb) DeleteOne(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*Mongodb) FindOne ¶
func (this *Mongodb) FindOne(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
func (*Mongodb) FindOneAndDelete ¶
func (this *Mongodb) FindOneAndDelete(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
func (*Mongodb) FindOneAndUpdate ¶
func (this *Mongodb) FindOneAndUpdate(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult
func (*Mongodb) InsertMany ¶
func (this *Mongodb) InsertMany(sqltable core.SqlTable, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func (*Mongodb) InsertManyByCtx ¶
func (this *Mongodb) InsertManyByCtx(sqltable core.SqlTable, ctx context.Context, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func (*Mongodb) InsertOne ¶
func (this *Mongodb) InsertOne(sqltable core.SqlTable, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
func (*Mongodb) ListCollectionNames ¶
func (this *Mongodb) ListCollectionNames(filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error)
func (*Mongodb) UpdateMany ¶
func (this *Mongodb) UpdateMany(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*Mongodb) UpdateManyByCtx ¶
func (this *Mongodb) UpdateManyByCtx(sqltable core.SqlTable, ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*Mongodb) UpdateOne ¶
func (this *Mongodb) UpdateOne(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*Mongodb) UseSession ¶
func (this *Mongodb) UseSession(fn func(sessionContext mongo.SessionContext) error) error
type Option ¶
type Option func(*Options)
func SetMaxPoolSize ¶
func SetMongodbDatabase ¶
func SetMongodbUrl ¶
func SetTimeOut ¶
Click to show internal directories.
Click to hide internal directories.