mongodb

package
v1.0.0-beta.16 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientDisconnected  = mongo.ErrClientDisconnected
	ErrEmptySlice          = mongo.ErrEmptySlice
	ErrInvalidIndexValue   = mongo.ErrInvalidIndexValue
	ErrMissingResumeToken  = mongo.ErrMissingResumeToken
	ErrMultipleIndexDrop   = mongo.ErrMultipleIndexDrop
	ErrNilCursor           = mongo.ErrNilCursor
	ErrNilDocument         = mongo.ErrNilDocument
	ErrNoDocuments         = mongo.ErrNoDocuments
	ErrNonStringIndexName  = mongo.ErrNonStringIndexName
	ErrUnacknowledgedWrite = mongo.ErrUnacknowledgedWrite
	ErrWrongClient         = mongo.ErrWrongClient
)
View Source
var (
	Default = StdConfig("default").Build()
)

Functions

func Client added in v1.0.0

func Client() *mongo.Client

func DB added in v1.0.0

func DB(name string, opts ...*options.DatabaseOptions) *mongo.Database

Types

type A

type A = bson.A

type Config added in v1.0.0

type Config struct {
	URI                  string `config:"uri" desc:"mongodb uri string."`
	EnableCommandMonitor bool   `config:"commandMonitor"`
	EnablePoolMonitor    bool   `config:"poolMonitor"`
	// contains filtered or unexported fields
}

func DefaultConfig added in v1.0.0

func DefaultConfig(key string) *Config

func StdConfig added in v1.0.0

func StdConfig(key string, optionFunc ...OptionFunc) *Config

func (*Config) Build added in v1.0.0

func (c *Config) Build() *Mongo

func (*Config) Path added in v1.0.0

func (c *Config) Path() string

type D

type D = bson.D

type E

type E = bson.E

type M

type M = bson.M

type Mongo

type Mongo struct {
	// contains filtered or unexported fields
}

func (*Mongo) Client added in v1.0.0

func (mgo *Mongo) Client() *mongo.Client

func (*Mongo) DB added in v1.0.0

func (mgo *Mongo) DB(db string, opts ...*options.DatabaseOptions) *mongo.Database

func (*Mongo) Name

func (mgo *Mongo) Name() string

func (*Mongo) Serve

func (mgo *Mongo) Serve(ctx context.Context) error

func (*Mongo) Shutdown

func (mgo *Mongo) Shutdown(ctx context.Context) error

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

func (*Monitor) CommandMonitor

func (mon *Monitor) CommandMonitor() *event.CommandMonitor

func (*Monitor) PoolEventMonitor

func (mon *Monitor) PoolEventMonitor() *event.PoolMonitor

type OptionFunc

type OptionFunc func(*Config)

func WithCommandMonitor

func WithCommandMonitor(monitor *event.CommandMonitor) OptionFunc

func WithPoolMonitor

func WithPoolMonitor(monitor *event.PoolMonitor) OptionFunc

Jump to

Keyboard shortcuts

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