mongodb

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeforeCreate

func BeforeCreate(document interface{}) interface{}

func BeforeUpdate

func BeforeUpdate(document interface{}) interface{}

func SetTrace

func SetTrace(t bool)

SetTrace 设置跟踪

Types

type Config

type Config struct {
	URI string
	// AppName string
	// ConnectTimeout  time.Duration
	MaxConnIdleTime time.Duration
	MaxPoolSize     uint64
	MinPoolSize     uint64
}

Config 配置

type MongoDB

type MongoDB struct {
	Client *mongo.Client
	Name   string
}

MongoDB 连接

func New

func New(config *Config) *MongoDB

New 数据库连接

func (*MongoDB) Collection

func (client *MongoDB) Collection(table string) *collection

Collection 得到一个mongo操作对象

type Proxy

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

Proxy 代理

func NewProxy

func NewProxy() *Proxy

NewProxy 代理池

func (*Proxy) NameSpace

func (proxy *Proxy) NameSpace(group string) *MongoDB

NameSpace 获取分组

func (*Proxy) SetNameSpace

func (proxy *Proxy) SetNameSpace(group string, client *MongoDB)

SetNameSpace 设置组

Jump to

Keyboard shortcuts

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