Documentation ¶
Overview ¶
Package kv is an interface that the keyvalue backend uses to store data
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BadPtrError = errors.New("Bad pointer")
Error to return (wrap) on Get if Ptr is not a pointer, or not the right type.
View Source
var NotFoundError = errors.New("Not found")
Error to return (wrap) on Get if value not found
Functions ¶
This section is empty.
Types ¶
type Scanner ¶
type Scanner interface { // Scan returns some number of keys. If the collection does not exist, return // a nil slice. If there are no more keys, return true as end signal. Scan(ctx context.Context) ([]string, bool, error) }
Scanner is used to get all the keys for a collection. The concrete implementation will store any intermediate cursors or last key data so that the next call to Scan will pick up where the last one left off. Each instance will only be used once.
type Store ¶
type Store interface { // Retrieve value from store. If not found, returns NotFoundError. Ptr must // be a pointer to the type of value stored. Get(ctx context.Context, collection, key string, ptr any) error // Sets a value, creates collection if necessary Set(ctx context.Context, collection, key string, value any) error // Create a scanner that will be used to get all the keys in a collection. Keys(collection string) Scanner }
Store is an interface to define to serve as a keyvalue store
Click to show internal directories.
Click to hide internal directories.