storage

package
v0.0.0-...-495f6ca Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTables

func CreateTables(db *sql.DB) error

func NewSqlite3DB

func NewSqlite3DB(file string) (*sql.DB, error)

Types

type InMemStore

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

func (InMemStore) DeleteShoppingList

func (s InMemStore) DeleteShoppingList(id string) error

func (InMemStore) DeleteShoppingListEntry

func (s InMemStore) DeleteShoppingListEntry(id string) error

func (InMemStore) FindUserByName

func (s InMemStore) FindUserByName(n string) (model.User, error)

func (InMemStore) GetShoppingList

func (s InMemStore) GetShoppingList(id string) (model.ShoppingList, error)

func (InMemStore) GetShoppingListEntries

func (s InMemStore) GetShoppingListEntries(id string) ([]model.Entry, error)

func (InMemStore) GetShoppingLists

func (s InMemStore) GetShoppingLists() ([]model.ShoppingList, error)

func (InMemStore) GetUsers

func (s InMemStore) GetUsers() ([]model.User, error)

func (InMemStore) StoreShoppingList

func (s InMemStore) StoreShoppingList(l model.ShoppingList) error

func (InMemStore) StoreShoppingListEntry

func (s InMemStore) StoreShoppingListEntry(listID string, e model.Entry) error

func (InMemStore) StoreUser

func (s InMemStore) StoreUser(u model.User) error

func (InMemStore) UpdateShoppingListEntry

func (s InMemStore) UpdateShoppingListEntry(e model.Entry) error

type SqlStore

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

func (SqlStore) DeleteShoppingList

func (s SqlStore) DeleteShoppingList(id string) error

func (SqlStore) DeleteShoppingListEntry

func (s SqlStore) DeleteShoppingListEntry(id string) error

func (SqlStore) FindUserByName

func (s SqlStore) FindUserByName(n string) (model.User, error)

func (SqlStore) GetShoppingList

func (s SqlStore) GetShoppingList(id string) (model.ShoppingList, error)

func (SqlStore) GetShoppingListEntries

func (s SqlStore) GetShoppingListEntries(id string) ([]model.Entry, error)

func (SqlStore) GetShoppingLists

func (s SqlStore) GetShoppingLists() ([]model.ShoppingList, error)

func (SqlStore) GetUsers

func (s SqlStore) GetUsers() ([]model.User, error)

func (SqlStore) StoreShoppingList

func (s SqlStore) StoreShoppingList(l model.ShoppingList) error

func (SqlStore) StoreShoppingListEntry

func (s SqlStore) StoreShoppingListEntry(listID string, e model.Entry) error

func (SqlStore) StoreUser

func (s SqlStore) StoreUser(u model.User) error

func (SqlStore) UpdateShoppingListEntry

func (s SqlStore) UpdateShoppingListEntry(e model.Entry) error

type Store

type Store interface {
	GetShoppingLists() ([]model.ShoppingList, error)
	GetShoppingList(id string) (model.ShoppingList, error)
	GetShoppingListEntries(id string) ([]model.Entry, error)
	StoreShoppingList(l model.ShoppingList) error
	DeleteShoppingList(id string) error
	StoreShoppingListEntry(listID string, entry model.Entry) error
	UpdateShoppingListEntry(e model.Entry) error
	DeleteShoppingListEntry(id string) error
	GetUsers() ([]model.User, error)
	StoreUser(u model.User) error
	FindUserByName(name string) (model.User, error)
}

func NewInMemStore

func NewInMemStore() Store

func NewSqlStore

func NewSqlStore(db *sql.DB) (Store, error)

Jump to

Keyboard shortcuts

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