store

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package store provides backing stores for bot data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetSetter added in v0.0.2

type GetSetter interface {
	Getter
	Setter
}

A GetSetter can both get and set data on a store.

type Getter added in v0.0.2

type Getter interface {
	Get(key string, empty []byte) ([]byte, error)
}

A Getter can retrieve a byte slice from a store under the given key. If the key doesn't exist then the empty value is returned.

type Object added in v0.0.2

type Object struct {
	Store GetSetter
}

Object store.

func (Object) Get added in v0.0.2

func (o Object) Get(key string, i interface{}) error

Get item from the object store and put it into the given interface.

func (Object) Set added in v0.0.2

func (o Object) Set(key string, i interface{}) error

Set object in the store.

type S3

type S3 struct {
	config.AWS `json:"-"`
}

S3 persistence store.

func (S3) Get

func (s S3) Get(object string, empty []byte) ([]byte, error)

Get the given object from S3. If the object doesn't exist it is created and set to the empty value.

func (S3) Set

func (s S3) Set(key string, data []byte) error

Set a document in S3. The provided data must marshal to JSON.

type Setter added in v0.0.2

type Setter interface {
	Set(key string, data []byte) error
}

A Setter can set a byte slice in the store under the given key.

Jump to

Keyboard shortcuts

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