Documentation ¶
Index ¶
- func Atomic(function func())
- func Delete(collection string, key string) error
- func DeleteCollection(collection string) error
- func GetKeys(collection string) ([]string, error)
- func InitStorage(path string) error
- func Read(collection string, key string, v any) error
- func SetStorage(storage Storage)
- func Write(collection string, key string, v any) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Atomic ¶ added in v2.2.10
func Atomic(function func())
Atomic execution of storage access. Useful when loading of a old key is needed to update it based on the value
func DeleteCollection ¶
DeleteCollection delete all entries of a collection
func InitStorage ¶
InitStorage registers a local directory as JSON file Storage
func SetStorage ¶
func SetStorage(storage Storage)
SetStorage provide Storage to persist data for bot usage
Types ¶
type Storage ¶
type Storage interface { Write(collection, key string, v any) error Read(collection, key string, v any) error GetKeys(collection string) ([]string, error) Delete(collection, key string) error }
Storage is the main interface which is used to persist bot related data (like queued messages or user histories)
func NewChainStorage ¶ added in v2.2.10
NewChainStorage combines two storages to have a persistent and fast a memory storage
func NewRedisStorage ¶
func NewRedisStorage(client *redis.Client) Storage
NewRedisStorage defined a redis bases storage to persist bot related information
Click to show internal directories.
Click to hide internal directories.