mongodb

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client() *mongo.Client

func Valid

func Valid() bool

Valid returns a bool valud to determine whether the connection is ready to use

Types

type MongoDB

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

func New

func New(opts ...Option) *MongoDB

func (*MongoDB) Connect

func (m *MongoDB) Connect() error

func (*MongoDB) Destory

func (m *MongoDB) Destory()

func (*MongoDB) Load

func (m *MongoDB) Load(src []byte) error

func (MongoDB) Name

func (m MongoDB) Name() string

type Option

type Option func(o *Options)

func WithAddress added in v0.0.44

func WithAddress(s string) Option

func WithAuth added in v0.0.44

func WithAuth(username, password string) Option

func WithCustomized added in v0.0.44

func WithCustomized() Option

WithCustomized will use your own configurations. To be reminder that you should make sure the values of Address, Auth, Port have been assigned correctly.

type Options added in v0.0.44

type Options struct {
	Address  string `json:"address"`
	Username string `json:"username"`
	Password string `json:"password"`
	// contains filtered or unexported fields
}

func (Options) URI added in v0.0.44

func (o Options) URI() string

Jump to

Keyboard shortcuts

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