models

package
v0.0.0-...-a2e4898 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorTypeNone ErrorType = iota
	ErrorTypeIncomplete
	ErrorTypeForeignKey
	ErrorTypeDuplicate
	ErrorTypeInvalid
	ErrorTypeQuery

	ErrorOpSave ErrorOp = iota
	ErrorOpGet
	ErrorOpDelete
	ErrorOpFind
)
View Source
const (
	ErrWrongMessageType = "wrong message type provided: got %d but wanted %d"
	ErrWrongDataType    = "wrong data type: got type %T but wanted %T"
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

ErrNotFound is a standard not found error

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type ByID

type ByID []*Task

ByID is a sortable array of tasks

func (ByID) Len

func (b ByID) Len() int

func (ByID) Less

func (b ByID) Less(i, j int) bool

func (ByID) Swap

func (b ByID) Swap(i, j int)

type CmdID

type CmdID int
const (
	Cmd_CreateTask CmdID = iota
	Cmd_CreatePomodoro
	Cmd_DeleteTask
	Cmd_GetList
	Cmd_GetServerStatus
	Cmd_GetTask
	Cmd_UpdateStatus
)

type Error

type Error struct {
	Type ErrorType
	Err  error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) ErrorForOp

func (e *Error) ErrorForOp(op ErrorOp) error

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorOp

type ErrorOp int

type ErrorType

type ErrorType int

type List

type List []Task

type ListResults

type ListResults struct {
	Count   int64 `json:"count"`
	Results List  `json:"results"`
}

type NoopNotifier

type NoopNotifier struct{}

NoopNotifier does nothing

func (NoopNotifier) Notify

func (n NoopNotifier) Notify(string, string) error

type Notifier

type Notifier interface {
	Notify(string, string) error
}

Notifier sends a system notification

func NewXnotifier

func NewXnotifier(iconPath string) Notifier

type Payload

type Payload interface {
}

type Pomodoro

type Pomodoro struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

Pomodoro is a unit of time to spend working on a single task.

func (Pomodoro) Duration

func (p Pomodoro) Duration() time.Duration

Duration returns the runtime of the pomodoro

type PomodoroWithID

type PomodoroWithID struct {
	TaskID   int
	Pomodoro Pomodoro
}

PomodoroWithID is a unit for requesting an update to a pomodoro to the server

type Protocol

type Protocol struct {
	Cid     CmdID
	Payload Payload
}

type Results

type Results struct {
	Count   int64       `json:"count"`
	Results interface{} `json:"results"`
}

type Runner

type Runner interface {
	Status() *Status
	SetStatus(status Status)
}

type State

type State int
const (
	RUNNING State = iota + 1
	BREAKING
	COMPLETE
	PAUSED
)

func (State) String

func (s State) String() string

type Status

type Status struct {
	State      State         `json:"state"`
	Remaining  time.Duration `json:"remaining"`
	Count      int           `json:"count"`
	NPomodoros int           `json:"n_pomodoros"`
}

Status is used to communicate the state of a running Pomodoro session

type Task

type Task struct {
	ID      int    `json:"id"`
	Message string `json:"message"`
	// Array of completed pomodoros
	Pomodoros []*Pomodoro `json:"pomodoros"`
	// Free-form tags associated with this task
	Tags []string `json:"tags"`
	// Number of pomodoros for this task
	NPomodoros int `json:"n_pomodoros"`
	// Duration of each pomodoro
	Duration time.Duration `json:"duration"`
}

Task describes some activity

func After

func After(start time.Time, tasks []Task) []Task

After returns tasks that were started after the provided start time.

type Wheel

type Wheel int

Wheel keeps track of an ASCII spinner

func (*Wheel) String

func (w *Wheel) String() string

type Xnotifier

type Xnotifier struct {
	*notificator.Notificator
	// contains filtered or unexported fields
}

Xnotifier can push notifications to mac, linux and windows.

func (Xnotifier) Notify

func (n Xnotifier) Notify(title, body string) error

Notify sends a notification to the OS.

Jump to

Keyboard shortcuts

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