storeService

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func StoreCharset

func StoreCharset(c string) Option

func StoreConnMaxIdleTime

func StoreConnMaxIdleTime(d time.Duration) Option

Mysql

func StoreConnMaxLifetime

func StoreConnMaxLifetime(d time.Duration) Option

func StoreDb

func StoreDb(d string) Option

func StoreHost

func StoreHost(h string) Option

func StoreMaxIdleConns

func StoreMaxIdleConns(n int) Option

func StoreMaxOpenConns

func StoreMaxOpenConns(n int) Option

func StorePasswd

func StorePasswd(p string) Option

func StorePort

func StorePort(p int) Option

func StoreTyped

func StoreTyped(t StoreType) Option

func StoreUser

func StoreUser(u string) Option

type Options

type Options struct {
	Type            StoreType //存储类型
	Host            string    //地址
	Port            int       //端口
	User            string    //用户
	Passwd          string    //密码
	Db              string    //db
	Charset         string    //编码
	ConnMaxIdleTime time.Duration
	ConnMaxLifetime time.Duration
	MaxIdleConns    int
	MaxOpenConns    int
}

type StoreService

type StoreService struct {
	Mysql *sql.DB
	Mongo *mongo.Client
	Redis redis.Conn
	// contains filtered or unexported fields
}

func NewStoreService

func NewStoreService(typ StoreType, opts ...Option) (*StoreService, error)

type StoreType

type StoreType int
const (
	StoreMysql StoreType
	StoreMongodb
)

Jump to

Keyboard shortcuts

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