Documentation ¶
Index ¶
Constants ¶
View Source
const ( LogEventGet = "GET" LogEventSet = "SET" LogEventRefill = "REFILL" LogEventDel = "DEL" LogEventSync = "SYNC" LogEventSyncAdd = "SYNCSET" LogEventSyncDelete = "SYNCDELETE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶
type Adaptor[K comparable, V Metadata] interface { // Name 适配器名称,需要在当前业务场景中保证唯一 Name() string // Get 读取对象 Get(ctx context.Context, key K, value V) (bool, error) // Set 写入对象 Set(ctx context.Context, value V) error // Del 删除对象 Del(ctx context.Context, key K) error }
Adaptor 定义了核心的数据读写删除等适配接口
type Metadata ¶
type Metadata interface { // Key 该对象的Key Key() string // Value 对象序列化后的值 Value() ([]byte, error) // Decode 对象反序列化 Decode([]byte) error // Zero 判定对象是否为零值 Zero() bool }
Metadata 原数据定义
type MultiAdaptor ¶
type MultiAdaptor[K comparable, V Metadata] interface { // Name 适配器名称,需要在当前业务场景中保证唯一 Name() string // Get 读取对象 Get(ctx context.Context, keys Keys[K], vals Values[K, V], fn NewValueFunc[V]) (Keys[K], error) // Set 写入对象 Set(ctx context.Context, vals ValueCol[V]) error // Del 删除对象 Del(ctx context.Context, keys Keys[K]) error }
MultiAdaptor 批量数据操作适配器接口
Click to show internal directories.
Click to hide internal directories.