mongo

package
v0.0.0-...-768fa91 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyQueryOpts

func ApplyQueryOpts(opts ...QueryOpt) *options.FindOptions

func CloseMongo

func CloseMongo() error

func GetMongoDB

func GetMongoDB() *mongo.Database

func InitMongoDB

func InitMongoDB(c *MongoConf)

func NewMongoCollection

func NewMongoCollection(coll string) *mongo.Collection

func SetUpdateTime

func SetUpdateTime(update bson.M) bson.M

Types

type MongoConf

type MongoConf struct {
	Url         string `json:"url"`
	DateBase    string `json:"data_base"`
	Timeout     int    `json:"timeout"`
	MaxPoolSize uint64 `json:"max_pool_size"`
	MinPoolSize uint64 `json:"min_pool_size"`
	Monitor     bool   `json:"monitor"`
	logger.Logger
}

type QueryOpt

type QueryOpt func(*QueryOptions)

func Limit

func Limit(limit int64) QueryOpt

func Select

func Select(selector bson.M) QueryOpt

func Skip

func Skip(skip int64) QueryOpt

func Sort

func Sort(sort bson.M) QueryOpt

func SortD

func SortD(sortD bson.D) QueryOpt

type QueryOptions

type QueryOptions struct {
	Skip     int64
	Limit    int64
	Sort     bson.M
	SortD    bson.D
	Selector bson.M
}

Jump to

Keyboard shortcuts

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