backend

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisBackend

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

RedisBackend implements app.Backend to provide simple KV storage

func NewRedisBackend

func NewRedisBackend(url string) (*RedisBackend, error)

NewRedisBackend returns a redis backed storage for the application

func (*RedisBackend) Delete

func (b *RedisBackend) Delete(c context.Context, identifier string) error

func (*RedisBackend) Retrieve

func (b *RedisBackend) Retrieve(c context.Context, identifier string) ([]byte, error)

func (*RedisBackend) Save

func (b *RedisBackend) Save(c context.Context, identifier string, data []byte) error

func (*RedisBackend) SaveTTL

func (b *RedisBackend) SaveTTL(c context.Context, identifier string, data []byte, ttl time.Duration) error

type SQLiteBackend

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

SQLiteBackend implements app.Backend to persist KV data

func NewSQLiteBackend

func NewSQLiteBackend(dbPath string) (*SQLiteBackend, error)

NewSQLiteBackend returns a SQLite backend for the application

func (*SQLiteBackend) Delete

func (s *SQLiteBackend) Delete(c context.Context, identifier string) error

func (*SQLiteBackend) Retrieve

func (s *SQLiteBackend) Retrieve(c context.Context, identifier string) ([]byte, error)

func (*SQLiteBackend) Save

func (s *SQLiteBackend) Save(c context.Context, identifier string, data []byte) error

func (*SQLiteBackend) SaveTTL

func (s *SQLiteBackend) SaveTTL(c context.Context, identifier string, data []byte, ttl time.Duration) error

type SQLiteData

type SQLiteData struct {
	ID      string `gorm:"primaryKey"`
	Data    []byte
	Created time.Time
	Expires time.Time
}

SQLiteData is the data model for storing bytes in SQLite

func (SQLiteData) TableName

func (SQLiteData) TableName() string

TableName is used for gorm.io only, overwriting the default table name

Jump to

Keyboard shortcuts

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