store

package
v0.0.0-...-9d8ded8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOpenFailed = errors.New("store: open failed")

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(cache cache.Cache, prefix string) *Cache

NewCache returns a new Cache.

func (*Cache) Erase

func (c *Cache) Erase(key string) error

Erase implements the Store interface.

func (*Cache) Load

func (c *Cache) Load(key string) ([]byte, error)

Load implements the Store interface.

func (*Cache) Save

func (c *Cache) Save(key string, value []byte) error

Save implements the Store interface.

type Cookie struct {
	// contains filtered or unexported fields
}

func NewCookie

func NewCookie(cookie *http.Cookie, secret []byte) *Cookie

NewCookie return a new Cookie.

func (*Cookie) Erase

func (c *Cookie) Erase(_ string) error

Erase implements the Store interface.

func (*Cookie) Load

func (c *Cookie) Load(_ string) ([]byte, error)

Load implements the Store interface.

func (*Cookie) Save

func (c *Cookie) Save(_ string, value []byte) error

Save implements the Store interface.

type KV

type KV struct {
	// contains filtered or unexported fields
}

func NewKV

func NewKV(kv kv.KV, prefix string) *KV

NewKV returns a new KV.

func (*KV) Erase

func (k *KV) Erase(key string) error

Erase implements the Store interface.

func (*KV) Load

func (k *KV) Load(key string) ([]byte, error)

Load implements the Store interface.

func (*KV) Save

func (k *KV) Save(key string, value []byte) error

Save implements the Store interface.

type Object

type Object struct {
	// contains filtered or unexported fields
}

func NewObject

func NewObject(object object.Object, folder string) *Object

NewObject returns a new Object.

func (*Object) Erase

func (o *Object) Erase(key string) error

Erase implements the Store interface.

func (*Object) Load

func (o *Object) Load(key string) ([]byte, error)

Load implements the Store interface.

func (*Object) Save

func (o *Object) Save(key string, value []byte) error

Save implements the Store interface.

type SQL

type SQL struct {
	// contains filtered or unexported fields
}

func NewSQL

func NewSQL(sql sql.SQL, table string) *SQL

NewSQL returns a new SQL.

func (*SQL) Erase

func (s *SQL) Erase(key string) error

Erase implements the Store interface.

func (*SQL) Load

func (s *SQL) Load(key string) ([]byte, error)

Load implements the Store interface.

func (*SQL) Save

func (s *SQL) Save(key string, value []byte) error

Save implements the Store interface.

type Store

type Store interface {
	// Load loads the value of the provided key.
	Load(key string) ([]byte, error)
	// Save saves the value of the provided key.
	Save(key string, value []byte) error
	// Erase erases the value of the provided key.
	Erase(key string) error
}

Store represents a persistent store.

type String

type String struct {
	// contains filtered or unexported fields
}

func NewString

func NewString(s *string, secret []byte) *String

NewString return a new String.

func (*String) Erase

func (s *String) Erase(_ string) error

Erase implements the Store interface.

func (*String) Load

func (s *String) Load(_ string) ([]byte, error)

Load implements the Store interface.

func (*String) Save

func (s *String) Save(_ string, value []byte) error

Save implements the Store interface.

Jump to

Keyboard shortcuts

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