Documentation ¶
Index ¶
- func InitMongo(cl *mongo.Client, database *mongo.Database, hook in.Hook) db.NoSql
- type Mongo
- func (d *Mongo) Aggregate(ctx context.Context, col string, q []interface{}, v interface{}) error
- func (d *Mongo) AggregateWithDiskUse(ctx context.Context, col string, q []interface{}, v interface{}) error
- func (d *Mongo) BulkUpdate(ctx context.Context, col string, models []mongo.WriteModel) error
- func (d *Mongo) Count(ctx context.Context, col string, q interface{}) (int64, error)
- func (d *Mongo) DeleteMany(ctx context.Context, col string, filter interface{}) error
- func (d *Mongo) Disconnect(ctx context.Context) error
- func (d *Mongo) Distinct(ctx context.Context, col, field string, q interface{}, v interface{}) error
- func (d *Mongo) DropIndices(ctx context.Context, col string, index []db.Index) error
- func (d *Mongo) EnsureIndices(ctx context.Context, col string, index []db.Index) error
- func (d *Mongo) FindOne(ctx context.Context, col string, q interface{}, v interface{}, ...) error
- func (d *Mongo) Insert(ctx context.Context, col string, doc interface{}) error
- func (d *Mongo) InsertMany(ctx context.Context, col string, docs []interface{}) error
- func (d *Mongo) List(ctx context.Context, col string, filter interface{}, skip, limit int64, ...) error
- func (d *Mongo) PartialUpdateMany(ctx context.Context, col string, filter interface{}, data interface{}) error
- func (d *Mongo) PartialUpdateManyByQuery(ctx context.Context, col string, filter interface{}, query db.UnorderedDbQuery) error
- func (d *Mongo) Ping(ctx context.Context) error
- func (d *Mongo) Update(ctx context.Context, col string, filter interface{}, data interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mongo ¶
type Mongo struct { *mongo.Client Database *mongo.Database // contains filtered or unexported fields }
Mongo holds necessary fields and mongo Database session to connect
func GetDbConnection ¶
func GetDbConnection() *Mongo
func (*Mongo) AggregateWithDiskUse ¶
func (*Mongo) BulkUpdate ¶
func (*Mongo) DeleteMany ¶
func (*Mongo) DropIndices ¶
DropIndices drops indices from collection col
func (*Mongo) EnsureIndices ¶
EnsureIndices creates indices for collection col
func (*Mongo) FindOne ¶
func (d *Mongo) FindOne(ctx context.Context, col string, q interface{}, v interface{}, sort ...interface{}) error
FindOne finds a doc by query
func (*Mongo) InsertMany ¶
func (*Mongo) List ¶
func (d *Mongo) List(ctx context.Context, col string, filter interface{}, skip, limit int64, v interface{}, sort ...interface{}) error
List finds list of docs that matches query with skip and limit
func (*Mongo) PartialUpdateMany ¶
func (*Mongo) PartialUpdateManyByQuery ¶
Click to show internal directories.
Click to hide internal directories.