store

package
v0.0.0-...-e672c87 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func New

func New(dsn string) *Store

func (*Store) CreateTask

func (s *Store) CreateTask(ctx context.Context, data TaskData) (task Task, err error)

func (*Store) DeleteTask

func (s *Store) DeleteTask(ctx context.Context, id uint64) error

func (*Store) Init

func (s *Store) Init() (err error)

func (*Store) ListTasks

func (s *Store) ListTasks(ctx context.Context) (tasks []Task, err error)

func (*Store) ListTasksFiltered

func (s *Store) ListTasksFiltered(ctx context.Context, filter TaskStatus) (tasks []Task, err error)

func (*Store) Name

func (s *Store) Name() string

func (*Store) Run

func (s *Store) Run() error

func (*Store) Stop

func (s *Store) Stop() error

func (*Store) UpdateTask

func (s *Store) UpdateTask(ctx context.Context, id uint64, newData TaskData) (Task, error)

type Task

type Task struct {
	ID        uint64    `db:"id"`
	CreatedAt time.Time `db:"created_at"`
	TaskData
}

type TaskData

type TaskData struct {
	Title       string     `db:"title"`
	Status      TaskStatus `db:"status"`
	Description *string    `db:"description"`
}

type TaskStatus

type TaskStatus uint8
const (
	StatusUnknown TaskStatus = iota
	StatusDone
	StatusWaiting
	StatusWorking
)

func ParseStatus

func ParseStatus(s string) TaskStatus

func (*TaskStatus) Scan

func (s *TaskStatus) Scan(value interface{}) error

func (TaskStatus) String

func (s TaskStatus) String() string

func (TaskStatus) Value

func (s TaskStatus) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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