mongox

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(name string) *mongo.Client

Get ...

func Range

func Range(fn func(name string, db *mongo.Client) bool)

Range 遍历所有实例

Types

type Config

type Config struct {
	Name string
	// DSN地址
	DSN string `json:"dsn" toml:"dsn"`
	// 创建连接的超时时间
	SocketTimeout time.Duration `json:"socketTimeout" toml:"socketTimeout"`
	// 连接池大小(最大连接数)
	PoolLimit int `json:"poolLimit" toml:"poolLimit"`
	// contains filtered or unexported fields
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig 默认配置

func RawConfig

func RawConfig(key string) *Config

RawConfig 裸配置

func StdConfig

func StdConfig(name string) *Config

StdConfig 返回标准配置

func (*Config) Build

func (config *Config) Build() *mongo.Client

func (*Config) Singleton added in v0.6.1

func (config *Config) Singleton() *mongo.Client

Jump to

Keyboard shortcuts

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