mgo

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncFind

func AsyncFind[T any](coll string, filter any, fn func([]*T, error), opts ...*options.FindOptions)

func AsyncFindOne

func AsyncFindOne[T any](coll string, filter any, fn func(*T, error), opts ...*options.FindOneOptions)

func AsyncFindOneAndUpdate

func AsyncFindOneAndUpdate[T any](coll string, filter, update any, fn func(*T, error), opts ...*options.FindOneAndUpdateOptions)

func AsyncUpdateOne

func AsyncUpdateOne(coll string, filter, update any, fn func(*mongo.UpdateResult, error), opts ...*options.UpdateOptions)

func BuildProjectionD

func BuildProjectionD(d *bson.D, exclude []string, keys ...string)

func CheckColl

func CheckColl() *util.Err

func Client

func Client() *mongo.Client

func Coll

func Coll(coll string) *mongo.Collection

func Conn

func Conn(db string, clientOpt *options.ClientOptions, dbOpt *options.DatabaseOptions) *util.Err

func CountDoc

func CountDoc(coll string, filter any, opts ...*options.CountOptions) (int64, error)

func Db

func Db() *mongo.Database

func DelMany

func DelMany(coll string, filter any, opts ...*options.DeleteOptions) (int64, *util.Err)

func DelOne

func DelOne(coll string, filter any, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func DisConn

func DisConn()

func Find

func Find[T any](coll string, filter any, items *[]*T, opts ...*options.FindOptions) error

func FindOne

func FindOne(coll string, filter any, item any, opts ...*options.FindOneOptions) error

func FindOneAndDel

func FindOneAndDel(coll string, filter any, item any, opts ...*options.FindOneAndDeleteOptions) error

func FindOneAndUpdate

func FindOneAndUpdate(coll string, filter, update any, item any, opts ...*options.FindOneAndUpdateOptions) error

func FindWithTotal

func FindWithTotal[T any](coll string, filter any, fn func(int64, []*T, error), opts ...*options.FindOptions)

func InitColl

func InitColl(coll string, idxModel func() []mongo.IndexModel, opts ...*options.CollectionOptions)

func InsertMany

func InsertMany(coll string, items []any, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)

func InsertOne

func InsertOne(coll string, item any, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)

func ReplaceOne

func ReplaceOne(coll string, filter, replacement any, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)

func Tx

func Tx(sessionOpt *options.SessionOptions, txOpt *options.TransactionOptions,
	fn util.ToErr) *util.Err

func UpdateMany

func UpdateMany(coll string, filter, update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

func UpdateOne

func UpdateOne(coll string, filter, update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL