storage

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(collection string, key string) error

Delete will return a single entry of a collection

func DeleteCollection added in v1.6.0

func DeleteCollection(collection string) error

DeleteCollection delete all entries of a collection

func GetKeys added in v1.2.0

func GetKeys(collection string) ([]string, error)

GetKeys will return the (json) strings of a collection

func InitStorage

func InitStorage(path string) error

InitStorage registers a local directory as JSON file Storage

func Read

func Read(collection string, key string, v interface{}) error

Read will load the stored data for one entry (using reference) to avoid allocation

func SetStorage added in v1.2.0

func SetStorage(storage Storage)

SetStorage provide Storage to persist data for bot usage

func Write

func Write(collection string, key string, v interface{}) error

Write stores one value in the persistent Storage

Types

type Storage added in v1.6.0

type Storage interface {
	Write(collection, key string, v interface{}) error
	Read(collection, key string, v interface{}) error
	GetKeys(collection string) ([]string, error)
	Delete(collection, key string) error
}

func NewRedisStorage added in v1.2.0

func NewRedisStorage(client *redis.Client) Storage

NewRedisStorage defined a redis bases storage to persist bot related information

Jump to

Keyboard shortcuts

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