repository

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	ID          *datastore.Key `datastore:"__key__"`
	Description string
	Text        string
	Done        bool
	Due         time.Time `datastore:",omitempty"`
	CreatedAt   time.Time

	Metadata metadata
}

Task is the model used to store tasks in the datastore.

type TaskRepository

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

TaskRepository is task repository.

func NewTaskRepository

func NewTaskRepository(client *datastore.Client) *TaskRepository

NewTaskRepository returns task repository.

func (*TaskRepository) AddTask

func (r *TaskRepository) AddTask(ctx context.Context, description string, createdAt time.Time) (*datastore.Key, error)

AddTask adds a task with the given description to the datastore, returning the key of the newly created entity.

func (*TaskRepository) DeleteTask

func (r *TaskRepository) DeleteTask(ctx context.Context, taskID int64) error

DeleteTask deletes the task with the given ID.

func (*TaskRepository) FilterKey

func (r *TaskRepository) FilterKey(ctx context.Context, key *datastore.Key) ([]*entity.Task, error)

FilterKey returns tasks by key.

func (*TaskRepository) ListTasks

func (r *TaskRepository) ListTasks(ctx context.Context) ([]*entity.Task, error)

ListTasks returns all the tasks in ascending order of creation time.

func (*TaskRepository) MarkDone

func (r *TaskRepository) MarkDone(ctx context.Context, taskID int64) error

MarkDone marks the task done with the given ID.

Jump to

Keyboard shortcuts

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