mongodb

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

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