mongodb

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 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{}

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
	// contains filtered or unexported fields
}

MongoDB 连接

func New

func New(config *Config) *MongoDB

New 数据库连接

func (*MongoDB) Collection

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

Collection 得到一个mongo操作对象

func (*MongoDB) SetTrace added in v2.0.2

func (mongodb *MongoDB) SetTrace(t bool)

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