store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 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 MemStore

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

func NewMemStore

func NewMemStore() *MemStore

func (*MemStore) Get

func (s *MemStore) Get(ctx context.Context, key string) (string, error)

func (*MemStore) Scanner

func (s *MemStore) Scanner(ctx context.Context) (Scanner, error)

func (*MemStore) Set

func (s *MemStore) Set(ctx context.Context, key, value string) error

type Postgres

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

func NewPostgres

func NewPostgres(url string) (*Postgres, error)

func (*Postgres) Get

func (p *Postgres) Get(ctx context.Context, key string) (string, error)

func (*Postgres) Scanner

func (p *Postgres) Scanner(ctx context.Context) (Scanner, error)

func (*Postgres) Set

func (p *Postgres) Set(ctx context.Context, key, value string) error

type Scanner

type Scanner interface {
	Next() bool
	Err() error

	Key() string
	Value() string

	Close() error
}

type Store

type Store interface {
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key, value string) error

	Scanner(ctx context.Context) (Scanner, error)
}

type TXTFile

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

TXTFile is a store that reads and writes to a text file.

Note: This is not a performant store, it is only intended for small amounts of data, and does not handle concurrent access beyond a single process.

func NewTXTFile

func NewTXTFile(path string) *TXTFile

func (*TXTFile) Get

func (t *TXTFile) Get(ctx context.Context, key string) (string, error)

func (*TXTFile) Scanner

func (t *TXTFile) Scanner(ctx context.Context) (Scanner, error)

func (*TXTFile) Set

func (t *TXTFile) Set(ctx context.Context, key, value string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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