db

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateListName = errors.New("a list with this name already exists")
)

Functions

func InitDB

func InitDB(dbFile string) (*sql.DB, error)

Types

type DeadlineFilter added in v0.3.0

type DeadlineFilter string
const (
	DeadlineToday    DeadlineFilter = "today"
	DeadlineOverdue  DeadlineFilter = "overdue"
	DeadlineThisWeek DeadlineFilter = "this-week"
)

type GetAllFilters

type GetAllFilters struct {
	ListID   string
	Priority *model.Priority
	Status   string // "pending", "completed", "all" (empty defaults to pending)
	Deadline *DeadlineFilter
	Page     int
	PageSize int
}

type ListStore added in v0.2.0

type ListStore interface {
	CreateList(list *model.List) error
	GetAllLists() ([]model.List, error)
	GetListByID(id string) (*model.List, error)
	UpdateList(list *model.List) error
	DeleteList(id string) error
}

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(db *sql.DB) *SQLiteStore

func (*SQLiteStore) CreateList added in v0.2.0

func (s *SQLiteStore) CreateList(list *model.List) error

func (*SQLiteStore) CreateTask added in v0.2.0

func (s *SQLiteStore) CreateTask(task *model.Task) error

func (*SQLiteStore) DeleteList added in v0.2.0

func (s *SQLiteStore) DeleteList(id string) error

func (*SQLiteStore) DeleteTask added in v0.2.0

func (s *SQLiteStore) DeleteTask(id string) error

func (*SQLiteStore) GetAllLists added in v0.2.0

func (s *SQLiteStore) GetAllLists() ([]model.List, error)

func (*SQLiteStore) GetAllTasks added in v0.2.0

func (s *SQLiteStore) GetAllTasks(filters GetAllFilters) ([]model.Task, int, error)

func (*SQLiteStore) GetDB added in v0.2.0

func (s *SQLiteStore) GetDB() *sql.DB

func (*SQLiteStore) GetListByID added in v0.2.0

func (s *SQLiteStore) GetListByID(id string) (*model.List, error)

func (*SQLiteStore) GetTaskByID added in v0.2.0

func (s *SQLiteStore) GetTaskByID(id string) (*model.Task, error)

func (*SQLiteStore) UpdateList added in v0.2.0

func (s *SQLiteStore) UpdateList(list *model.List) error

func (*SQLiteStore) UpdateTask added in v0.2.0

func (s *SQLiteStore) UpdateTask(task *model.Task) error

type TaskStore

type TaskStore interface {
	CreateTask(task *model.Task) error
	GetAllTasks(filters GetAllFilters) ([]model.Task, int, error)
	GetTaskByID(id string) (*model.Task, error)
	UpdateTask(task *model.Task) error
	DeleteTask(id string) error
}

Jump to

Keyboard shortcuts

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