Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileTaskStore ¶
type FileTaskStore struct {
// contains filtered or unexported fields
}
Persists tasks to disk.
func NewFileTaskStore ¶
func NewFileTaskStore(database *os.File) (*FileTaskStore, error)
type FileUserStore ¶
type FileUserStore struct {
// contains filtered or unexported fields
}
func NewFileUserStore ¶
func NewFileUserStore(database *os.File) (*FileUserStore, error)
func (*FileUserStore) AddUser ¶
func (f *FileUserStore) AddUser(email string, password *models.PasswordHash) error
type TaskStore ¶
type TaskStore interface {
// Get all tasks (possibly an empty slice) for `user`.
//
// Returns an empty slice and error if something prevented the tasks from being retrieved from the store.
GetTasks(user string) ([]models.Task, error)
// Get a single task by its `id`.
//
// Returns `nil` if a task with `id` was not found.
//
// Returns `nil` and an error if something prevented the tasks from being retrieved from the store.
GetTask(id uint64) (*models.Task, error)
// Create and add a new task for `user`.
//
// Returns an error if something prevented the task from being created or added to the store.
AddTask(user string, description string) error
}
Handles the creation and retrieval of tasks.
type UserStore ¶
type UserStore interface {
// AddUser adds a new user to the store.
AddUser(email string, password *models.PasswordHash) error
// GetUser retrieves a user by their ID.
GetUser(id uint64) (*models.User, error)
// GetUsers retrieves all users.
GetUsers() ([]models.User, error)
}
UserStore is an interface for storing and retrieving users.
Click to show internal directories.
Click to hide internal directories.