mongodb

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 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

func WithAddress(s string) Option

func WithAuth

func WithAuth(username, password string) Option

func WithCustomized

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

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

func (Options) URI

func (o Options) URI() string

Jump to

Keyboard shortcuts

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