mongodb

package
v1.7.20 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MongoCommonCostMax   = 20
	MongoCmd             = "mongo_cmd_%v"
	MongoCmdSlowCount    = "mongo_%v_slow_count"
	MongoNormalSlowCount = "mongo_common_slow_count"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoClient

type MongoClient struct {
	DbConfig   *MongoConfig `inject:"mongoDbConfig" canNil:"true"`
	DbConf     *ini.File    `inject:"mongoDbConf" canNil:"true"`
	DbConfPath string       `inject:"mongoDbConfPath" canNil:"true"`
	DataBase   string       `inject:"mongoDatabase" canNil:"true"` // mongodb 实例名
	// contains filtered or unexported fields
}

func (*MongoClient) Close

func (m *MongoClient) Close()

func (*MongoClient) DeleteMany

func (m *MongoClient) DeleteMany(collection string, filter interface{}) (result int64, err error)

func (*MongoClient) DeleteOne

func (m *MongoClient) DeleteOne(collection string, filter interface{}) (result int64, err error)

func (*MongoClient) Find

func (m *MongoClient) Find(collection string, filter interface{}, opts ...*options.FindOptions) (result *mongo.Cursor, err error)

func (*MongoClient) FindOne

func (m *MongoClient) FindOne(collection string, filter interface{}) (result *mongo.SingleResult, err error)

func (*MongoClient) Insert

func (m *MongoClient) Insert(collection string, data []interface{}) (result []interface{}, err error)

func (*MongoClient) Start

func (m *MongoClient) Start() error

func (*MongoClient) UpdateMany

func (m *MongoClient) UpdateMany(collection string, data interface{}, filter interface{}) (result interface{}, err error)

func (*MongoClient) UpdateOne

func (m *MongoClient) UpdateOne(collection string, data interface{}, filter interface{}) (result interface{}, err error)

type MongoConfig

type MongoConfig struct {
	Hosts           []string
	User            string
	Password        string
	DataBase        string
	ReplicaSet      string
	ConnTimeoutMs   int64
	SocketTimeoutMs int64
	WTimeoutMs      int64
	MaxPoolSize     int
	MinPoolSize     int
	MaxIdleTimeMs   int64
	W               int
	Journal         string // true false
	Safe            string // true false
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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