mongo

package
v0.0.0-...-f4159b9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(o ...Option) (*mongo.Database, error)

New initializes a new database connection

Types

type Option

type Option func(*opts)

Option provides a function definition to set opts

func WithAuthName

func WithAuthName(p string) Option

WithName sets the db name.

func WithCluster

func WithCluster(p bool) Option

WithCluster sets this up as a clustered (srv) connection

func WithDirect

func WithDirect(p bool) Option

WithDirect tells mongo this is a direct connection.

func WithHost

func WithHost(p string) Option

WithHost sets the db host.

func WithName

func WithName(p string) Option

WithName sets the db name.

func WithPassword

func WithPassword(p string) Option

WithPassword sets the db password.

func WithPort

func WithPort(p int) Option

WithPort sets the listener port.

func WithRetryWrites

func WithRetryWrites(p bool) Option

WithRetryWrites turns retryWrites on or off

func WithUsername

func WithUsername(p string) Option

WithUsername sets the db username.

func WithViper

func WithViper(args ...string) Option

WithViper specifies that the server should construct its opts using viper.

func WithWriteConcern

func WithWriteConcern(p string) Option

WithWriteConcern sets the write concern (0, 1, or majority)

Jump to

Keyboard shortcuts

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