internal

package
v0.0.0-...-4b6ff60 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 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 ...any) error

NewErrorf instantiates a new error.

func PointerToValue

func PointerToValue[T any](ptr *T) T

PointerToValue converts a pointer of type *T to the value of type T it points to. It returns the zero value of T if the pointer is nil.

func ValueToPointer

func ValueToPointer[T any](value T) *T

ValueToPointer converts a value of type T to a pointer of type *T.

func WrapErrorf

func WrapErrorf(orig error, code ErrorCode, format string, a ...any) 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 {
	ID          string
	IsDone      bool
	Priority    *Priority
	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 ...

type UpdateParams

type UpdateParams struct {
	Description *string
	Priority    *Priority
	Dates       *Dates
	IsDone      *bool
}

UpdateParams defines the arguments used to update a Task record.

Directories

Path Synopsis
Package elasticsearch implements the Elasticsearch repository.
Package elasticsearch implements the Elasticsearch repository.
envvartesting
Code generated by counterfeiter.
Code generated by counterfeiter.
Package kafka implements the Kafka repository to publish events.
Package kafka implements the Kafka repository to publish events.
Package memcached implements the memcached repository to cache tasks.
Package memcached implements the memcached repository to cache tasks.
memcachedtesting
Code generated by counterfeiter.
Code generated by counterfeiter.
Package postgresql implements the PostgreSQL repository for tasks.
Package postgresql implements the PostgreSQL repository for tasks.
db
Package rabbitmq implements the RabbitMQ repository to publish events.
Package rabbitmq implements the RabbitMQ repository to publish events.
Package redis implements the Redis repository to publish events.
Package redis implements the Redis repository to publish events.
Package rest provides primitives to interact with the openapi HTTP API.
Package rest provides primitives to interact with the openapi HTTP API.
resttesting
Code generated by counterfeiter.
Code generated by counterfeiter.
servicetesting
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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