repository

package module
v0.0.0-...-64391f7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 5 Imported by: 0

README

go-redis

Golang utility functions for Redis DB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleError

func HandleError(err error)

Types

type RedisConfig

type RedisConfig struct {
	Host        string
	Port        string
	MaxIdle     int
	IdleTimeOut int
}

func NewRedisConfig

func NewRedisConfig(host, port string, maxIdle, IdleTimeOut int) *RedisConfig

type RedisRepository

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

func NewTradeRedisRepository

func NewTradeRedisRepository(config *RedisConfig) *RedisRepository

func (*RedisRepository) Close

func (r *RedisRepository) Close() error

func (*RedisRepository) DeleteByValue

func (r *RedisRepository) DeleteByValue(listName string, value interface{}, count int) error

func (*RedisRepository) DeleteKey

func (r *RedisRepository) DeleteKey(key string) error

func (*RedisRepository) GetHashMap

func (r *RedisRepository) GetHashMap(hashTableName string) (map[string]string, error)

func (*RedisRepository) GetHashMapField

func (r *RedisRepository) GetHashMapField(hashTableName string, fieldName interface{}) (string, error)

func (*RedisRepository) GetKey

func (r *RedisRepository) GetKey(keyName string) ([]byte, error)

func (*RedisRepository) GetList

func (r *RedisRepository) GetList(listName string) ([][]byte, error)

GetList execute "LRANGE 0 -1" to given list

func (*RedisRepository) GetListN

func (r *RedisRepository) GetListN(listName string, n int) ([][]byte, error)

func (*RedisRepository) SaveInHash

func (r *RedisRepository) SaveInHash(hashTableName, fieldName string, thing interface{}) error

SaveInHash executes "HSET ..." - creates hashmap and/or adds field with given value

func (*RedisRepository) SaveInList

func (r *RedisRepository) SaveInList(listName string, thing interface{}, end bool) error

SaveInList executes "rpush" or "lpush" to given list

func (*RedisRepository) SaveKey

func (r *RedisRepository) SaveKey(keyName string, thing interface{}) error

Jump to

Keyboard shortcuts

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