ssdb

package
v1.6.22 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSSdbPool

func GetSSdbPool(config map[string]string) (*pool.Connectors, error)

GetSSdbPool 获取ssdb连接池

Types

type GoSSDBContent

type GoSSDBContent struct {
	// contains filtered or unexported fields
}

GoSSDBContent 集合上下文

func DataBaseMapping

func DataBaseMapping(mappingName string, configFn func(mappingName string) map[string]string, prefixNamesFn func() map[string]int) (*GoSSDBContent, error)

DataBaseMapping 添加映射 @client 连接对象 @dataName 数据库名

func (*GoSSDBContent) GetGoSSDBRepository

func (s *GoSSDBContent) GetGoSSDBRepository(prefixName string) (ISSdbRepository, bool)

GetGoSSDBRepository 获取集合仓储 entity 结构体

type ISSdbRepository added in v1.6.5

type ISSdbRepository interface {

	// Set 插入单个
	// entity  结构体
	// ttl     单位秒 ,0为永不到期
	Set(key string, entity interface{}, ttl int64) (int64, error)

	// SetMany 插入多个【单次20000个以下】
	// entityMap 结构体字典
	SetMany(entityMap map[string]interface{}) (int64, error)

	//Incr 递增字段值
	//key hashid
	//fieid 字段名称
	Incr(key, field string, num int64) (int64, error)

	//GetIncr 获取递增字段值
	//key hashid
	//res 要获取的字段值
	GetIncr(key string, res map[string]int64) (err error)

	//RemoveIncr 移除递增
	//key hashid
	RemoveIncr(key string) error

	//Remove 删除单个
	// key key值
	Remove(key ...string) (int64, error)

	//Get 查询单个
	// key         key值
	// result      查询的结果
	Get(key string, result interface{}) error

	// GetMany 查询多个[只支持string类型]
	// keys        key值切片
	// result      查询的结果切片
	GetMany(keys []string, result interface{}) error

	// CreateKey 创建内部key(配合直接使用数据库连接(GetClient)使用,其它方法不需要使用内部已调用)
	// prefix 前缀
	// key
	CreateKey(prefix, key string) string

	//Do 直接执行
	Do(f func(*pool.Client)) error
}

ISSdbRepository 仓储接口(只支持string类型)

type SSdbRepository added in v1.6.5

type SSdbRepository struct {
	// contains filtered or unexported fields
}

SSdbRepository SSDB 仓储(string)

func (*SSdbRepository) CreateKey added in v1.6.5

func (s *SSdbRepository) CreateKey(prefix, key string) string

CreateKey 创建内部key

func (*SSdbRepository) Do added in v1.6.13

func (s *SSdbRepository) Do(h func(*pool.Client)) error

Do 直接执行

func (*SSdbRepository) Get added in v1.6.5

func (s *SSdbRepository) Get(key string, result interface{}) error

Get 查询单个 key key值 result 查询的结果

func (*SSdbRepository) GetIncr added in v1.6.5

func (s *SSdbRepository) GetIncr(key string, res map[string]int64) (err error)

GetIncr 获取递增值

func (*SSdbRepository) GetMany added in v1.6.5

func (s *SSdbRepository) GetMany(keys []string, result interface{}) error

GetMany 查询多个 keys key值切片 result 查询的结果切片

func (*SSdbRepository) Incr added in v1.6.5

func (s *SSdbRepository) Incr(key, field string, num int64) (int64, error)

Incr 递增

func (*SSdbRepository) Remove added in v1.6.5

func (s *SSdbRepository) Remove(keys ...string) (int64, error)

Remove 移除 keys key值切片

func (*SSdbRepository) RemoveIncr added in v1.6.5

func (s *SSdbRepository) RemoveIncr(key string) error

RemoveIncr 清理递增字段

func (*SSdbRepository) Set added in v1.6.5

func (s *SSdbRepository) Set(key string, entity interface{}, ttl int64) (int64, error)

Set 插入单个[key数据存在会更新] entity 结构体 ttl 单位秒 ,0为永不到期

func (*SSdbRepository) SetMany added in v1.6.5

func (s *SSdbRepository) SetMany(entityMap map[string]interface{}) (int64, error)

SetMany 插入多个 [key数据存在会更新] entityMap 结构体字典

Jump to

Keyboard shortcuts

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