internal

package
v0.0.0-...-527e48b Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package internal defines the types used to create Tasks and their corresponding attributes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorf

func NewErrorf(code ErrorCode, format string, a ...interface{}) error

NewErrorf instantiates a new error.

func WrapErrorf

func WrapErrorf(orig error, code ErrorCode, format string, a ...interface{}) error

WrapErrorf returns a wrapped error.

Types

type Category

type Category string

Category is human readable value meant to be used to organize your tasks. Category values are unique.

type CreateParams

type CreateParams struct {
	Description string
	Priority    Priority
	Dates       Dates
}

CreateParams defines the arguments used for creating Task records.

func (CreateParams) Validate

func (c CreateParams) Validate() error

Validate indicates whether the fields are valid or not.

type Dates

type Dates struct {
	Start time.Time
	Due   time.Time
}

Dates indicates a point in time where a task starts or completes, dates are not enforced on Tasks.

func (Dates) Validate

func (d Dates) Validate() error

Validate ...

type Error

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

Error represents an error that could be wrapping another error, it includes a code for determining what triggered the error.

func (*Error) Code

func (e *Error) Code() ErrorCode

Code returns the code representing this error.

func (*Error) Error

func (e *Error) Error() string

Error returns the message, when wrapping errors the wrapped error is returned.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error, if any.

type ErrorCode

type ErrorCode uint

ErrorCode defines supported error codes.

const (
	ErrorCodeUnknown ErrorCode = iota
	ErrorCodeNotFound
	ErrorCodeInvalidArgument
)

type Priority

type Priority int8

Priority indicates how important a Task is.

const (
	// PriorityNone indicates the task needs to be prioritized.
	PriorityNone Priority = iota

	// PriorityLow indicates a non urgent task.
	PriorityLow

	// PriorityMedium indicates a task that should be completed soon.
	PriorityMedium

	// PriorityHigh indicates an urgent task that must be completed as soon as possible.
	PriorityHigh
)

func (Priority) Validate

func (p Priority) Validate() error

Validate ...

type SearchParams

type SearchParams struct {
	Description *string
	Priority    *Priority
	IsDone      *bool
	From        int64
	Size        int64
}

SearchParams defines the arguments used for searching Task records.

func (SearchParams) IsZero

func (a SearchParams) IsZero() bool

IsZero determines whether the search arguments have values or not.

type SearchResults

type SearchResults struct {
	Tasks []Task
	Total int64
}

SearchResults defines the collection of tasks that were found.

type Task

type Task struct {
	IsDone      bool
	Priority    Priority
	ID          string
	Description string
	Dates       Dates
	SubTasks    []Task
	Categories  []Category
}

Task is an activity that needs to be completed within a period of time.

func (Task) Validate

func (t Task) Validate() error

Validate ...

Directories

Path Synopsis
envvartesting
Code generated by counterfeiter.
Code generated by counterfeiter.
db
resttesting
Code generated by counterfeiter.
Code generated by counterfeiter.
tools module

Jump to

Keyboard shortcuts

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