Documentation ¶
Index ¶
- func GetSSdbPool(config map[string]string) (*gossdb.Connectors, error)
- type GoSSDBContent
- type GoSSDBRepository
- func (s *GoSSDBRepository) CreateKey(prefix, key string) string
- func (s *GoSSDBRepository) Get(key string, result interface{}) error
- func (s *GoSSDBRepository) GetClient() *gossdb.Client
- func (s *GoSSDBRepository) GetIncr(key string, res map[string]int64) (err error)
- func (s *GoSSDBRepository) GetMany(keys []string, result interface{}) error
- func (s *GoSSDBRepository) Incr(key, field string, num int64) (int64, error)
- func (s *GoSSDBRepository) Remove(keys ...string) (int64, error)
- func (s *GoSSDBRepository) RemoveIncr(key string) error
- func (s *GoSSDBRepository) Set(key string, entity interface{}, ttl int64) (int, error)
- func (s *GoSSDBRepository) SetMany(entityMap map[string]interface{}) (int64, error)
- type IGoSSDBRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GoSSDBContent ¶
type GoSSDBContent struct {
// contains filtered or unexported fields
}
集合上下文
func DataBaseMapping ¶
func DataBaseMapping(pool *gossdb.Connectors) *GoSSDBContent
添加映射 @client 连接对象 @dataName 数据库名
func (*GoSSDBContent) GetGoSSDBRepository ¶
func (s *GoSSDBContent) GetGoSSDBRepository(entity interface{}) IGoSSDBRepository
获取集合仓储 entity 结构体
type GoSSDBRepository ¶
type GoSSDBRepository struct {
// contains filtered or unexported fields
}
SSDB 仓储(string)
func (*GoSSDBRepository) CreateKey ¶
func (s *GoSSDBRepository) CreateKey(prefix, key string) string
创建内部key
func (*GoSSDBRepository) Get ¶
func (s *GoSSDBRepository) Get(key string, result interface{}) error
查询单个 key key值 result 查询的结果
func (*GoSSDBRepository) GetIncr ¶
func (s *GoSSDBRepository) GetIncr(key string, res map[string]int64) (err error)
获取递增值
func (*GoSSDBRepository) GetMany ¶
func (s *GoSSDBRepository) GetMany(keys []string, result interface{}) error
查询多个 keys key值切片 result 查询的结果切片
func (*GoSSDBRepository) Incr ¶
func (s *GoSSDBRepository) Incr(key, field string, num int64) (int64, error)
递增
func (*GoSSDBRepository) Remove ¶
func (s *GoSSDBRepository) Remove(keys ...string) (int64, error)
移除 keys key值切片
func (*GoSSDBRepository) RemoveIncr ¶
func (s *GoSSDBRepository) RemoveIncr(key string) error
清理递增字段
type IGoSSDBRepository ¶
type IGoSSDBRepository interface { // 插入单个 // entity 结构体 // ttl 单位秒 ,0为永不到期 Set(key string, entity interface{}, ttl int64) (int, error) // 插入多个【单次20000个以下】 // entityMap 结构体字典 SetMany(entityMap map[string]interface{}) (int64, error) //递增字段值 //key hashid //fieid 字段名称 Incr(key, field string, num int64) (int64, error) //获取递增字段值 //key hashid //res 要获取的字段值 GetIncr(key string, res map[string]int64) (err error) //移除递增 //key hashid RemoveIncr(key string) error // 删除单个 // key key值 Remove(key ...string) (int64, error) //查询单个 // key key值 // result 查询的结果 Get(key string, result interface{}) error //查询多个[只支持string类型] // keys key值切片 // result 查询的结果切片 GetMany(keys []string, result interface{}) error // 创建内部key(配合直接使用数据库连接(GetClient)使用,其它方法不需要使用内部已调用) // prefix 前缀 // key CreateKey(prefix, key string) string //获取客户端(使用后需要调用 Close 方法关闭回收) GetClient() *gossdb.Client }
SSDB 仓储接口(只支持string类型)
Click to show internal directories.
Click to hide internal directories.