lino_redis

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 11 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Lino Redis

High level Redis wrapper for Go.

Architecture

LinoRedis
    -> Fork(subPath) -> LinoRedis
    -> Get(subPath)
    -> Set(subPath, value)
    -> AnyCommand(subPath, ...)
    -> NewRedisItem(subPath) -> RedisItem
    -> NewAnyComplexType(subPath) -> AnyComplexType

RedisItem
    -> Get()
    -> Set(value)
    -> AnyCommand(...)

Develop

start redis

docker run --name lino_redis-test --rm -p 6379:6379 redis

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLockFailed  = errors.New("lock failed")
	ErrChannelDone = errors.New("channel done")
)

Functions

This section is empty.

Types

type Bitmap

type Bitmap struct {
	HBLock         *HeartBeatLock
	BitLockBaseKey *LinoRedis
	BitDataBaseKey *LinoRedis
	// contains filtered or unexported fields
}

func (*Bitmap) Del added in v0.0.3

func (l *Bitmap) Del(ctx context.Context) error

func (*Bitmap) FindBit added in v0.0.5

func (l *Bitmap) FindBit(ctx context.Context, bit int8, start int64, end int64) (int64, error)

func (*Bitmap) Get

func (l *Bitmap) Get(ctx context.Context) (*[]byte, error)

func (*Bitmap) GetBit

func (l *Bitmap) GetBit(ctx context.Context, index int64) (int64, error)

func (*Bitmap) GetBool

func (l *Bitmap) GetBool(ctx context.Context, index int64) (bool, error)

func (*Bitmap) GetRange added in v0.0.3

func (l *Bitmap) GetRange(ctx context.Context, start int64, end int64) (*[]byte, error)

func (*Bitmap) LoopBits added in v0.0.5

func (l *Bitmap) LoopBits(ctx context.Context, bit int8, start int64, end int64) func() (int64, error)

func (*Bitmap) Set

func (l *Bitmap) Set(ctx context.Context, data *[]byte) error

func (*Bitmap) SetBit

func (l *Bitmap) SetBit(ctx context.Context, index int64, bit int64) error

func (*Bitmap) SetBool

func (l *Bitmap) SetBool(ctx context.Context, index int64, value bool) error

type HeartBeatLock

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

func (*HeartBeatLock) Del added in v0.0.6

func (l *HeartBeatLock) Del(ctx context.Context) error

func (*HeartBeatLock) Lock

func (l *HeartBeatLock) Lock(ctx context.Context) error

func (*HeartBeatLock) TryLock

func (l *HeartBeatLock) TryLock(ctx context.Context) error

func (*HeartBeatLock) Unlock

func (l *HeartBeatLock) Unlock(ctx context.Context) error

type KeyResolver added in v0.0.7

type KeyResolver func(parts ...string) string

type LinoRedis

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

func LoadRedis added in v0.0.8

func LoadRedis(dsn string) (*LinoRedis, error)

func LoadRedisWithPrefix added in v0.0.8

func LoadRedisWithPrefix(dsn string) (*LinoRedis, error)

func MustLoadRedis added in v0.0.8

func MustLoadRedis(dsn string) *LinoRedis

func MustLoadRedisWithPrefix added in v0.0.8

func MustLoadRedisWithPrefix(dsn string) *LinoRedis

func NewLinoRedis

func NewLinoRedis(client *redis.Client, basePath string) *LinoRedis

func (*LinoRedis) BitField added in v0.0.3

func (l *LinoRedis) BitField(ctx context.Context, subPath string, args ...interface{}) ([]int64, error)

Bitfield

func (*LinoRedis) BitPos added in v0.0.5

func (l *LinoRedis) BitPos(ctx context.Context, subPath string, bit int64, args ...int64) (int64, error)

func (*LinoRedis) BitPosSpan added in v0.0.5

func (l *LinoRedis) BitPosSpan(ctx context.Context, subPath string, bit int8, start int64, end int64, span string) (int64, error)

func (*LinoRedis) Close added in v0.0.7

func (l *LinoRedis) Close() error

func (*LinoRedis) Decr added in v0.0.11

func (l *LinoRedis) Decr(ctx context.Context, subPath string) (int64, error)

func (*LinoRedis) DecrBy added in v0.0.11

func (l *LinoRedis) DecrBy(ctx context.Context, subPath string, value int64) (int64, error)

func (*LinoRedis) Del

func (l *LinoRedis) Del(ctx context.Context, subPath string) error

func (*LinoRedis) Expire

func (l *LinoRedis) Expire(ctx context.Context, subPath string, expiration time.Duration) (bool, error)

func (*LinoRedis) Fork

func (l *LinoRedis) Fork(parts ...string) *LinoRedis

func (*LinoRedis) Forkf added in v0.0.7

func (l *LinoRedis) Forkf(format string, args ...interface{}) *LinoRedis

func (*LinoRedis) Get

func (l *LinoRedis) Get(ctx context.Context, subPath string) *redis.StringCmd

Basic Operations

func (*LinoRedis) GetBit

func (l *LinoRedis) GetBit(ctx context.Context, subPath string, offset int64) (int64, error)

Bitmap

func (*LinoRedis) GetRange added in v0.0.3

func (l *LinoRedis) GetRange(ctx context.Context, subPath string, start int64, end int64) ([]byte, error)

func (*LinoRedis) GetResolver

func (l *LinoRedis) GetResolver() func(parts ...string) string

func (*LinoRedis) HDel

func (l *LinoRedis) HDel(ctx context.Context, subPath string, fields ...string) (int64, error)

func (*LinoRedis) HExists

func (l *LinoRedis) HExists(ctx context.Context, subPath string, field string) (bool, error)

func (*LinoRedis) HGet

func (l *LinoRedis) HGet(ctx context.Context, subPath string, field string) *redis.StringCmd

Hash

func (*LinoRedis) HGetAll

func (l *LinoRedis) HGetAll(ctx context.Context, subPath string) (map[string]string, error)

func (*LinoRedis) HMGet

func (l *LinoRedis) HMGet(ctx context.Context, subPath string, fields ...string) ([]interface{}, error)

func (*LinoRedis) HMSet

func (l *LinoRedis) HMSet(ctx context.Context, subPath string, fields map[string]interface{}) error

func (*LinoRedis) HSet

func (l *LinoRedis) HSet(ctx context.Context, subPath string, field string, value interface{}) (int64, error)

func (*LinoRedis) Incr added in v0.0.11

func (l *LinoRedis) Incr(ctx context.Context, subPath string) (int64, error)

Number

func (*LinoRedis) IncrBy added in v0.0.11

func (l *LinoRedis) IncrBy(ctx context.Context, subPath string, value int64) (int64, error)

func (*LinoRedis) IncrByFloat added in v0.0.11

func (l *LinoRedis) IncrByFloat(ctx context.Context, subPath string, value float64) (float64, error)

func (*LinoRedis) MGet

func (l *LinoRedis) MGet(ctx context.Context, subPaths ...string) *redis.SliceCmd

Multi Operations

func (*LinoRedis) MSet

func (l *LinoRedis) MSet(ctx context.Context, values map[string]string) error

func (*LinoRedis) NewBitmap

func (l *LinoRedis) NewBitmap(basePath string) *Bitmap

func (*LinoRedis) NewHeartBeatLock

func (l *LinoRedis) NewHeartBeatLock(subPath string, heartBeatInterval time.Duration) *HeartBeatLock

func (*LinoRedis) NewPipeline added in v0.0.7

func (l *LinoRedis) NewPipeline(resolver *KeyResolver) *Pipeline

func (*LinoRedis) NewRLEBitfield added in v0.0.7

func (l *LinoRedis) NewRLEBitfield(basePath string) *RLEBitfield

func (*LinoRedis) NewRedisItem

func (l *LinoRedis) NewRedisItem(subPath string) *RedisItem

func (*LinoRedis) NewRedisItemf added in v0.0.7

func (l *LinoRedis) NewRedisItemf(format string, args ...interface{}) *RedisItem

func (*LinoRedis) NewRedisSet added in v0.0.7

func (l *LinoRedis) NewRedisSet(subPath string) *RedisSet

func (*LinoRedis) NewScaner

func (l *LinoRedis) NewScaner(subPath string, opts *ScanOptions) *Scaner

func (*LinoRedis) Ping

func (l *LinoRedis) Ping(timeout time.Duration) bool

func (*LinoRedis) PrintKey

func (l *LinoRedis) PrintKey()

func (*LinoRedis) SAdd

func (l *LinoRedis) SAdd(ctx context.Context, subPath string, members ...interface{}) (int64, error)

Set

func (*LinoRedis) SCard added in v0.0.7

func (l *LinoRedis) SCard(ctx context.Context, subPath string) (int64, error)

func (*LinoRedis) SIsMember

func (l *LinoRedis) SIsMember(ctx context.Context, subPath string, member interface{}) (bool, error)

func (*LinoRedis) SMembers

func (l *LinoRedis) SMembers(ctx context.Context, subPath string) ([]string, error)

func (*LinoRedis) SPop

func (l *LinoRedis) SPop(ctx context.Context, subPath string) (string, error)

func (*LinoRedis) SRem

func (l *LinoRedis) SRem(ctx context.Context, subPath string, members ...interface{}) (int64, error)

func (*LinoRedis) Scan

func (l *LinoRedis) Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd

Keys

func (*LinoRedis) Set

func (l *LinoRedis) Set(ctx context.Context, subPath string, value interface{}, expiration time.Duration) (string, error)

func (*LinoRedis) SetBit

func (l *LinoRedis) SetBit(ctx context.Context, subPath string, offset int64, value int) (int64, error)

func (*LinoRedis) SetEX

func (l *LinoRedis) SetEX(ctx context.Context, subPath string, value interface{}, expiration time.Duration) (string, error)

func (*LinoRedis) SetNX

func (l *LinoRedis) SetNX(ctx context.Context, subPath string, value interface{}, expiration time.Duration) (bool, error)

func (*LinoRedis) TTL added in v0.0.6

func (l *LinoRedis) TTL(ctx context.Context, subPath string) (time.Duration, error)

TTL

type Pipeline added in v0.0.7

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

type RLEBitfield added in v0.0.7

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

func (*RLEBitfield) Del added in v0.0.7

func (l *RLEBitfield) Del(ctx context.Context) error

func (*RLEBitfield) Get added in v0.0.7

func (*RLEBitfield) Lock added in v0.0.7

func (l *RLEBitfield) Lock(ctx context.Context) error

func (*RLEBitfield) Set added in v0.0.7

func (l *RLEBitfield) Set(ctx context.Context, bf *bitfield.BitField) error

func (*RLEBitfield) Unlock added in v0.0.7

func (l *RLEBitfield) Unlock(ctx context.Context) error

type RedisItem

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

func (*RedisItem) BitField added in v0.0.3

func (l *RedisItem) BitField(ctx context.Context, args ...interface{}) ([]int64, error)

func (*RedisItem) BitPos added in v0.0.5

func (l *RedisItem) BitPos(ctx context.Context, bit int64, args ...int64) (int64, error)

func (*RedisItem) BitPosSpan added in v0.0.5

func (l *RedisItem) BitPosSpan(ctx context.Context, bit int8, start int64, end int64, span string) (int64, error)

func (*RedisItem) Decr added in v0.0.11

func (l *RedisItem) Decr(ctx context.Context) (int64, error)

func (*RedisItem) DecrBy added in v0.0.11

func (l *RedisItem) DecrBy(ctx context.Context, value int64) (int64, error)

func (*RedisItem) Del

func (l *RedisItem) Del(ctx context.Context) error

func (*RedisItem) Expire

func (l *RedisItem) Expire(ctx context.Context, expiration time.Duration) (bool, error)

func (*RedisItem) Get

func (l *RedisItem) Get(ctx context.Context) *redis.StringCmd

func (*RedisItem) GetBit

func (l *RedisItem) GetBit(ctx context.Context, offset int64) (int64, error)

func (*RedisItem) GetRange added in v0.0.3

func (l *RedisItem) GetRange(ctx context.Context, start int64, end int64) ([]byte, error)

func (*RedisItem) Incr added in v0.0.11

func (l *RedisItem) Incr(ctx context.Context) (int64, error)

func (*RedisItem) IncrBy added in v0.0.11

func (l *RedisItem) IncrBy(ctx context.Context, value int64) (int64, error)

func (*RedisItem) IncrByFloat added in v0.0.11

func (l *RedisItem) IncrByFloat(ctx context.Context, value float64) (float64, error)

func (*RedisItem) Set

func (l *RedisItem) Set(ctx context.Context, value interface{}, expiration time.Duration) (string, error)

func (*RedisItem) SetBit

func (l *RedisItem) SetBit(ctx context.Context, offset int64, value int) (int64, error)

func (*RedisItem) SetEX

func (l *RedisItem) SetEX(ctx context.Context, value interface{}, expiration time.Duration) (string, error)

func (*RedisItem) SetNX

func (l *RedisItem) SetNX(ctx context.Context, value interface{}, expiration time.Duration) (bool, error)

func (*RedisItem) TTL added in v0.0.6

func (l *RedisItem) TTL(ctx context.Context) (time.Duration, error)

type RedisSet added in v0.0.7

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

func (*RedisSet) Add added in v0.0.7

func (l *RedisSet) Add(ctx context.Context, members ...interface{}) (int64, error)

func (*RedisSet) Clear added in v0.0.7

func (l *RedisSet) Clear(ctx context.Context) error

func (*RedisSet) IsMember added in v0.0.7

func (l *RedisSet) IsMember(ctx context.Context, member interface{}) (bool, error)

func (*RedisSet) Members added in v0.0.7

func (l *RedisSet) Members(ctx context.Context) ([]string, error)

func (*RedisSet) Pop added in v0.0.7

func (l *RedisSet) Pop(ctx context.Context) (string, error)

func (*RedisSet) Remove added in v0.0.7

func (l *RedisSet) Remove(ctx context.Context, members ...interface{}) (int64, error)

func (*RedisSet) Size added in v0.0.7

func (l *RedisSet) Size(ctx context.Context) (int64, error)

type ScanOptions

type ScanOptions struct {
	Match     string
	Count     int64
	BatchSize int64
}

type Scaner

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

func (*Scaner) FetchSubKeys

func (r *Scaner) FetchSubKeys(ctx context.Context) (*[]string, error)

func (*Scaner) Next

func (r *Scaner) Next(ctx context.Context) (*LinoRedis, bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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