db

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ChConn driver.Conn
)

Functions

func DB

func DB(ctx context.Context) *gorm.DB

func GetJSON

func GetJSON[T any](ctx context.Context, key string, data *T) error

GetJSON 从Redis获取数据并反序列化为泛型类型 ctx: 上下文 key: Redis key data: 用于接收数据的指针(泛型)

func HGetJSON

func HGetJSON[T any](ctx context.Context, hashKey, fieldKey string, data *T) error

HGetJSON 从 Redis Hash 获取数据并反序列化为泛型类型 ctx: 上下文 hashKey: Redis Hash key fieldKey: Hash field key data: 用于接收数据的指针(泛型)

func HSetJSON

func HSetJSON[T any](ctx context.Context, hashKey, fieldKey string, data T) error

HSetJSON 将泛型数据序列化为 JSON 并设置到 Redis Hash ctx: 上下文 hashKey: Redis Hash key fieldKey: Hash field key data: 要存储的数据(泛型)

func PrefixedKey

func PrefixedKey(key string) string

PrefixedKey 返回带前缀的 Key

func SetJSON

func SetJSON[T any](ctx context.Context, key string, data T, expiration time.Duration) error

SetJSON 将泛型数据序列化为JSON并设置到Redis ctx: 上下文 key: Redis key data: 要存储的数据(泛型) expiration: 过期时间

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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