hash_helper

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTag          = "redis"
	DefaultTagHashKey   = "redis_hash_key"
	DefaultTagHashField = "redis_hash_field"
)

Variables

View Source
var (
	ErrorNoTagFound                = errors.New("no tag found")
	ErrorCacheDataIsNil            = errors.New("CacheData is nil")
	ErrorCacheDataIsEmpty          = errors.New("CacheData is empty")
	ErrorCacheDataIsError          = errors.New("CacheData is error")
	ErrorCacheDataExistedEmptyData = errors.New("CacheData existed empty data")
)

Functions

This section is empty.

Types

type HashHelper

type HashHelper struct {
	*base.Base
}

HashHelper Redis Hash类型助手类

func NewHashHelper

func NewHashHelper(b *base.Base) *HashHelper

NewHashHelper 实例化

func (HashHelper) HDel

func (s HashHelper) HDel(key, field string) (v *gvar.Var, err error)

func (HashHelper) HDelM

func (s HashHelper) HDelM(key string, fields []string) (v *gvar.Var, err error)

func (HashHelper) HDelOnlyError

func (s HashHelper) HDelOnlyError(key, field string) (err error)

func (HashHelper) HExists

func (s HashHelper) HExists(key, field string) (v *gvar.Var, err error)

func (HashHelper) HExistsNoError

func (s HashHelper) HExistsNoError(key, field string) (v *gvar.Var)

func (HashHelper) HGet

func (s HashHelper) HGet(key, field string) (v *gvar.Var, err error)

func (HashHelper) HIncrby

func (s HashHelper) HIncrby(key string, field string, increment int64) (v *gvar.Var, err error)

func (HashHelper) HMGet

func (s HashHelper) HMGet(key string, fields []string) (v *gvar.Var, err error)

func (HashHelper) HMSet

func (s HashHelper) HMSet(key string, fv g.Map) (v *gvar.Var, err error)

func (HashHelper) HScan

func (s HashHelper) HScan(key string, field string, callback func(key string, fieldVals g.MapStrStr) error, count ...int) (err error)

HScan 批量获取field 【注意】field里需要有通配符 比如:a:*

func (HashHelper) HSet

func (s HashHelper) HSet(key, field string, value interface{}) (v *gvar.Var, err error)

func (HashHelper) HSetNx

func (s HashHelper) HSetNx(key, field string, value interface{}) (v *gvar.Var, err error)

type HashMapIUDHelper added in v1.0.9

type HashMapIUDHelper struct {
	*base.Base
	// contains filtered or unexported fields
}

func NewHashMapIUDHelper added in v1.0.9

func NewHashMapIUDHelper(b *base.Base) *HashMapIUDHelper

func (*HashMapIUDHelper) IUD added in v1.0.9

func (s *HashMapIUDHelper) IUD(key string, fv g.Map, matchPattern ...string) (err error)

IUD 插入更新删除

func (*HashMapIUDHelper) IUDScript added in v1.0.10

func (s *HashMapIUDHelper) IUDScript(key string, fv g.Map) (err error)

IUDScript 插入更新删除

type HashStructHelper

type HashStructHelper[T any] struct {
	*base.Base
	// contains filtered or unexported fields
}

func NewHashStructHelper

func NewHashStructHelper[T any](b *base.Base) *HashStructHelper[T]

func (*HashStructHelper[T]) Get

func (s *HashStructHelper[T]) Get(key string) (data *T, err error)

Get 获取数据到结构体 For example:

type User struct {
    Name string `redis_hash_field:"name"`
    Age  int    `redis_hash_field:"age"`
}

func (*HashStructHelper[T]) Set

func (s *HashStructHelper[T]) Set(key string, data *T) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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