mongoclient

package
v0.61.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionBlobs         = "blobs"
	CollectionResellers     = "resellers"
	CollectionUsers         = "users"
	CollectionSubscriptions = "bb_subscriptions"
	CollectionSites         = "projects"
)

Variables

This section is empty.

Functions

func Connect

func Connect(log logrus.FieldLogger, config *Config) (*mongo.Client, error)

Connect connects to MongoDB

func ConnectWithOptions added in v0.40.0

func ConnectWithOptions(log logrus.FieldLogger, replSet string, servers []string, opts ...Option) (*mongo.Client, error)

Types

type Auth

type Auth struct {
	Username string
	Password string
	Source   string
}

type Config

type Config struct {
	AppName            string
	TLS                *nconf.TLSConfig
	Servers            []string
	ReplSetName        string
	ConnTimeout        time.Duration
	Auth               *Auth
	SecondaryPreferred bool
}

type Option added in v0.40.0

type Option func(opt *options.ClientOptions) error

func AppName added in v0.40.0

func AppName(name string) Option

func AuthOption added in v0.40.0

func AuthOption(config Auth) Option

func ConnectionTimeout added in v0.40.0

func ConnectionTimeout(dur time.Duration) Option

func SecondaryPreferred added in v0.40.0

func SecondaryPreferred() Option

func TLSOption added in v0.40.0

func TLSOption(log logrus.FieldLogger, config nconf.TLSConfig) Option

Jump to

Keyboard shortcuts

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