repositories

package
v0.0.0-...-0fc7de8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetR

func SetR(repo R)

Types

type FlatFile

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

func NewFlatFile

func NewFlatFile(dir string) (*FlatFile, error)

func (*FlatFile) AddTodo

func (ff *FlatFile) AddTodo(ctx context.Context, todo Todo) (created Todo, e error)

func (*FlatFile) DeleteTodo

func (ff *FlatFile) DeleteTodo(ctx context.Context, id string) error

func (*FlatFile) GetAll

func (ff *FlatFile) GetAll(ctx context.Context) (res []Todo, e error)

func (*FlatFile) GetTodoByID

func (ff *FlatFile) GetTodoByID(ctx context.Context, id string) (todo Todo, e error)

func (*FlatFile) ListTodo

func (ff *FlatFile) ListTodo(ctx context.Context, by string, desc bool, all bool) (res []Todo, e error)

func (*FlatFile) UpdateTodoStatus

func (ff *FlatFile) UpdateTodoStatus(ctx context.Context, todo Todo, newStatus bool) (updated Todo, e error)

func (*FlatFile) UpdateTodoTags

func (ff *FlatFile) UpdateTodoTags(ctx context.Context, todo Todo, tags []string) (updated Todo, e error)

type R

type R interface {
	AddTodo(context.Context, Todo) (Todo, error)
	GetTodoByID(context.Context, string) (Todo, error)
	UpdateTodoStatus(context.Context, Todo, bool) (Todo, error)
	UpdateTodoTags(context.Context, Todo, []string) (Todo, error)
	ListTodo(ctx context.Context, sortBy string, desc bool, all bool) ([]Todo, error)
	DeleteTodo(context.Context, string) error
}

func GetR

func GetR() (repo R, e error)

type Todo

type Todo struct {
	ID          uuid.UUID `json:"id"`
	Description string    `json:"description"`
	Weight      int       `json:"weight"`
	Tags        []string  `json:"tags"`
	Done        bool      `json:"done"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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