mongodb

package
v1.3.3 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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Host                  string `json:",default=localhost"`
	Username              string `json:",optional"`
	Password              string `json:",optional"`
	Port                  int    `json:",default=27017"`
	DBName                string `json:",optional"`
	Option                string `json:",optional"`
	AuthMechanism         string `json:",default=None,options=[SCRAM-SHA-256,SCRAM-SHA-1,MONGODB-X509,MONGODB-AWS,None]"`
	AuthSource            string `json:",optional"`
	TlsCAFile             string `json:",optional"`
	TlsCertificateKeyFile string `json:",optional"`
}

Conf is the MongoDB configuration structure.

func (Conf) GetDSN

func (c Conf) GetDSN() string

GetDSN returns the DSN link from the configuration.

func (Conf) MustNewClient

func (c Conf) MustNewClient() *mongo.Client

MustNewClient returns the client if the config is correct.

func (Conf) MustNewDatabase

func (c Conf) MustNewDatabase() *mongo.Database

MustNewDatabase returns the database if the config is correct.

Jump to

Keyboard shortcuts

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