store

package
v0.0.0-...-54a0288 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrAccountNotFound    = Error("account not found")
	ErrEmailAlreadyExists = Error("account already exists")
	ErrTaskNotFound       = Error("task not found")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        string
	Owner     string
	Email     string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type AccountQuery

type AccountQuery struct {
	Owner *string
	Email *string
	Range *Range
}

type AccountStore

type AccountStore interface {
	AddAccount(context.Context, *Account) error
	Account(context.Context, AccountQuery) (*Account, error)
	Accounts(context.Context, AccountQuery) ([]*Account, error)
}

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Range

type Range struct {
	Limit  int32
	Offset int32
}

type Store

type Store interface {
	Pipeline(context.Context, func(context.Context) error) error
	Accounts() AccountStore
	Tasks() TaskStore
}

func New

func New(db *spansqlx.DB) Store

type Task

type Task struct {
	ID        string
	AccountID string
	Name      string
	Undone    bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

type TaskQuery

type TaskQuery struct {
	AccountID *string
	Undone    *bool
}

type TaskStore

type TaskStore interface {
	Task(context.Context, TaskQuery) (*Task, error)
	Tasks(context.Context, TaskQuery) ([]*Task, error)
	AddTask(context.Context, *Task) error
	SetTaskDone(context.Context, string) error
}

Jump to

Keyboard shortcuts

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