mongo

package
v1.1.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ErrDuplicatedName utils.Error = "duplicated mongo name"
)

Variables

This section is empty.

Functions

func AppName

func AppName(name string) utils.OptionFunc[useOption]

func BsonOptions

func BsonOptions(bsonOptions *options.BSONOptions) utils.OptionFunc[useOption]

func Construct

func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func()

func ReadConcern

func ReadConcern(readConcern *readconcern.ReadConcern) utils.OptionFunc[useOption]

func ReadPreference

func ReadPreference(readPreference *readpref.ReadPref) utils.OptionFunc[useOption]

func Registry

func Registry(registry *bsoncodec.Registry) utils.OptionFunc[useOption]

func WriteConcern

func WriteConcern(writeConcern *writeconcern.WriteConcern) utils.OptionFunc[useOption]

Types

type Conf

type Conf struct {
	mongo.Option `yaml:",inline" json:",inline" toml:",inline"`
	EnableLogger bool `yaml:"enable_logger" json:"enable_logger" toml:"enable_logger" default:"false"`
	LoggerConfig struct {
		Logger           string   `yaml:"logger" json:"logger" toml:"logger" default:"github.com/wfusion/gofusion/log/customlogger.mongoLogger"`
		LogInstance      string   `yaml:"log_instance" json:"log_instance" toml:"log_instance" default:"default"`
		LoggableCommands []string `` /* 151-byte string literal not displayed */
	} `yaml:"logger_config" json:"logger_config" toml:"logger_config"`
}

Conf nolint: revive // struct tag too long issue

type Mongo

type Mongo struct {
	*mgoDrv.Database
	Name string
}

func Use

func Use(name string, opts ...utils.OptionExtender) *Mongo

Jump to

Keyboard shortcuts

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