mongox

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close added in v0.1.8

func Close()

Close 关闭Mongodb连接

func Init

func Init()

Init 初始化mongo数据库

func New

func New(key ...string) (*mongo.Collection, error)

New 根据数据库名称,集合名称获取集合操作对象;参数顺序database_name,collection_name;

func NewID added in v0.2.0

func NewID() string

NewID 生产字符串ID

func NewObjectID added in v0.2.0

func NewObjectID() primitive.ObjectID

NewObjectID 生成ObjectID

func RegisterMongoDB

func RegisterMongoDB()

RegisterMongoDB 注册mongodb

Types

type Config

type Config struct {
	Database string `mapstructure:"db"`
	Conn     string `mapstructure:"conn"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Timeout  int    `mapstructure:"timeout"`
	MaxPool  int    `mapstructure:"max_pool"`
}

Config mongo配置

Jump to

Keyboard shortcuts

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