mongodb

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB

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

func NewMongoDB

func NewMongoDB(opts ...Option) *MongoDB

func (*MongoDB) GetCollection

func (db *MongoDB) GetCollection(name string) *mongo.Collection

func (*MongoDB) Init

func (db *MongoDB) Init(opts ...Option) error

Init 初始化, 处理用户配置,生成mongo uri

func (*MongoDB) IsInvalid

func (db *MongoDB) IsInvalid() bool

func (*MongoDB) Start

func (db *MongoDB) Start() error

func (*MongoDB) UnInit

func (db *MongoDB) UnInit() error

type Option

type Option func(o *Options)

type Options

type Options struct {
	// User 用户名
	User string `yaml:"user"`
	// PassWord 密码
	Password string `yaml:"password"`
	// DB 数据库名
	DB string `yaml:"db"`
	//Mongos mongo 集群节点地址
	Mongos []string `yaml:"mongos"`
}

Jump to

Keyboard shortcuts

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