db

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 10 Imported by: 1

README

db

MongoDB,Redis,Redis Rank,Redis Set

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize added in v1.0.1

func Initialize(g *group.Group)

Types

type IDbClient

type IDbClient interface {
	Insert(attrName string, attrID interface{}, data map[string]interface{}) error
	Save(attrName string, attrID interface{}, data map[string]interface{}, needReply bool) error
	Del(attrName string, attrID interface{}, needReply bool) error
	Load(attrName string, attrID interface{}, isSync ...interface{}) (map[string]interface{}, error)
	Exists(attrName string, attrID interface{}) (bool, error)
	ForEach(attrName string, callback func(attrID interface{}, data map[string]interface{}))

	LoadAll(attrName string) ([]interface {
		GetAttrID() interface{}
		GetData() map[string]interface{}
	}, error)
	// contains filtered or unexported methods
}

func GetOrNewDbClient

func GetOrNewDbClient(cfg IDbConfig) IDbClient

type IDbConfig

type IDbConfig interface {
	//GetType() string
	GetAddr() string
	GetDB() string
	GetUser() string
	GetPassword() string
}

func IDbConfigCreator added in v1.0.1

func IDbConfigCreator(opfs ...OpFn) IDbConfig

type OpFn added in v1.0.1

type OpFn func(opt *Option)

func MongoDBConfig added in v1.0.1

func MongoDBConfig(addr, dbName string) OpFn

type Option added in v1.0.1

type Option struct {
	Addr     string
	DBName   string
	User     string
	Password string
}

func DefaultOption added in v1.0.1

func DefaultOption() *Option

func (*Option) GetAddr added in v1.0.1

func (op *Option) GetAddr() string

func (*Option) GetDB added in v1.0.1

func (op *Option) GetDB() string

func (*Option) GetPassword added in v1.0.1

func (op *Option) GetPassword() string

func (*Option) GetUser added in v1.0.1

func (op *Option) GetUser() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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