stores

package
v0.0.0-...-c72d624 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

func NewMemory

func NewMemory() *Memory

func (Memory) Clear

func (m Memory) Clear(_ string) error

func (Memory) Connect

func (m Memory) Connect() error

func (Memory) Create

func (m Memory) Create(_ string, todo *Todo) error

func (Memory) Delete

func (m Memory) Delete(_ string, id string) error

func (Memory) Get

func (m Memory) Get(_ string, id string) (*Todo, error)

func (Memory) List

func (m Memory) List(_ string) ([]Todo, error)

func (Memory) Update

func (m Memory) Update(listID string, id string, newT *Todo) (*Todo, error)

type RedisStore

type RedisStore struct {
	DBUrl string
	DB    *redis.Client
}

func NewRedisStore

func NewRedisStore(dbURL string) *RedisStore

func (RedisStore) Clear

func (r RedisStore) Clear(listID string) error

func (*RedisStore) Connect

func (r *RedisStore) Connect() error

func (RedisStore) Create

func (r RedisStore) Create(listID string, t *Todo) error

func (RedisStore) Delete

func (r RedisStore) Delete(listID string, id string) error

func (RedisStore) Get

func (r RedisStore) Get(listID string, id string) (*Todo, error)

func (RedisStore) List

func (r RedisStore) List(listID string) ([]Todo, error)

func (RedisStore) Update

func (r RedisStore) Update(listID string, id string, newT *Todo) (*Todo, error)

type SQLStore

type SQLStore struct {
	DBUrl string
	DB    *sql.DB
}

func NewSQLStore

func NewSQLStore(dbURL string) *SQLStore

func (SQLStore) Clear

func (s SQLStore) Clear(_ string) error

func (*SQLStore) Connect

func (s *SQLStore) Connect() error

func (SQLStore) Create

func (s SQLStore) Create(_ string, t *Todo) error

func (SQLStore) Delete

func (s SQLStore) Delete(_ string, id string) error

func (SQLStore) Get

func (s SQLStore) Get(_ string, id string) (*Todo, error)

func (SQLStore) List

func (s SQLStore) List(_ string) ([]Todo, error)

func (SQLStore) Update

func (s SQLStore) Update(listID string, id string, newT *Todo) (*Todo, error)

type Store

type Store interface {
	Connect() error
	Create(list string, todo *Todo) error
	Clear(list string) error
	Get(list string, id string) (*Todo, error)
	Update(list string, id string, todo *Todo) (*Todo, error)
	Delete(list string, id string) error
	List(list string) ([]Todo, error)
}

type Todo

type Todo struct {
	ID        string
	Title     string
	Completed bool
	Order     int
}

Jump to

Keyboard shortcuts

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