session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MulanPSL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 数据库操作默认超时时间(5 秒)
	DefaultTimeout = 5 * time.Second
	//Timeout db operation time out
	Timeout time.Duration
	DBName  = ""

	DbDecrypt Decrypt
)
View Source
var (
	ErrRootCAMissing = errors.New("rootCAFile is empty in config file")
)

db errors

Functions

func GetDB

func GetDB() *mongo.Database

GetDB get mongo db client

func Init

func Init(dbc DBConfig, ts ...reflect.Type) (err error)

Init prepare params

func TryDecrypt

func TryDecrypt(src string) string

TryDecrypt return the src when decrypt failed

Types

type DBConfig

type DBConfig struct {
	URI        string `yaml:"uri"`
	PoolSize   int    `yaml:"poolSize"`
	SSLEnabled bool   `yaml:"sslEnabled"`
	RootCA     string `yaml:"rootCAFile"`
	Timeout    string `yaml:"timeout"`
	VerifyPeer bool   `yaml:"verifyPeer"`
}

type Decrypt

type Decrypt func(src string) string

Decrypt decrypt db config

Jump to

Keyboard shortcuts

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