Documentation
¶
Index ¶
- func SetStorage(st Storage)
- type BulkOp
- type DbOp
- type JSONStorage
- func (js *JSONStorage) Add(item *TaskItem) error
- func (js *JSONStorage) Bulk(op BulkOp) error
- func (js *JSONStorage) Close() error
- func (js *JSONStorage) Init() error
- func (js *JSONStorage) Name() string
- func (js *JSONStorage) Remove(id int) error
- func (js *JSONStorage) Retrieve(id int) (*TaskItem, error)
- func (js *JSONStorage) RetrieveAll(offset, limit int) ([]*TaskItem, error)
- func (js *JSONStorage) Update(item *TaskItem) error
- type Storage
- type TaskItem
- type TaskList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DbOp ¶
type DbOp string
DbOp - opcode for bulk operations
var Create DbOp = "create"
Create -
var Delete DbOp = "delete"
Delete -
var Update DbOp = "update"
Update -
type JSONStorage ¶
type JSONStorage struct {
// contains filtered or unexported fields
}
JSONStorage -
func (*JSONStorage) Retrieve ¶
func (js *JSONStorage) Retrieve(id int) (*TaskItem, error)
Retrieve -
func (*JSONStorage) RetrieveAll ¶
func (js *JSONStorage) RetrieveAll(offset, limit int) ([]*TaskItem, error)
RetrieveAll -
type Storage ¶
type Storage interface {
Name() string
Init() error
Add(item *TaskItem) error
Remove(id int) error
Update(item *TaskItem) error
Retrieve(id int) (*TaskItem, error)
Bulk(op BulkOp) error
RetrieveAll(offset, limit int) ([]*TaskItem, error)
}
Storage - represents a storage backend for the task list
type TaskItem ¶
type TaskItem struct {
ID int `json:"id" db:"id"`
Heading string `json:"heading, required" db:"heading"`
Description string `json:"description" db:"description"`
Status string `json:"status" db:"status"`
Created time.Time `json:"created" db:"created"`
Deadline time.Time `json:"deadline" db:"deadline"`
Modified time.Time `json:"modified" db:"modified"`
}
TaskItem - represents a todo item
func NewTaskItem ¶
NewTaskItem -
Click to show internal directories.
Click to hide internal directories.