core

package
v0.0.0-...-8e2590b Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewID

func NewID(now time.Time) (string, error)

NewID returns a compact, time-ordered identifier. Format: 10 chars time + 16 chars entropy (Crockford-ish base32, no padding).

func NormalizeTag

func NormalizeTag(s string) string

func ParseTags

func ParseTags(s string) []string

Types

type Filter

type Filter struct {
	Statuses           []Status
	Tags               []string
	Priority           *Priority
	From               *time.Time
	To                 *time.Time
	IncludeNilDeadline bool
	Sort               SortMode
}

func (Filter) ApplyToTask

func (f Filter) ApplyToTask(t *Task)

type Priority

type Priority int
const (
	P0 Priority = 0
	P1 Priority = 1
	P2 Priority = 2
	P3 Priority = 3
)

func (Priority) Clamp

func (p Priority) Clamp() Priority

type SortMode

type SortMode string
const (
	SortDefault  SortMode = ""
	SortDeadline SortMode = "deadline"
	SortPriority SortMode = "priority"
	SortUpdated  SortMode = "updated"
	SortCreated  SortMode = "created"
)

type Status

type Status string
const (
	StatusTodo  Status = "todo"
	StatusDoing Status = "doing"
	StatusDone  Status = "done"
)

func (Status) Valid

func (s Status) Valid() bool

type Task

type Task struct {
	ID          string
	Title       string
	Description string
	Tags        []string
	Priority    Priority
	Deadline    *time.Time
	Status      Status
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (Task) MarshalJSON

func (t Task) MarshalJSON() ([]byte, error)

func (Task) NormalizedTags

func (t Task) NormalizedTags() []string

func (Task) Validate

func (t Task) Validate() error

type TaskPatch

type TaskPatch struct {
	Title       *string
	Description *string
	Tags        *[]string
	Priority    *Priority
	Deadline    **time.Time
	Status      *Status
}

func (TaskPatch) ApplyTo

func (p TaskPatch) ApplyTo(t Task) Task

type View

type View struct {
	ID       ViewID
	Title    string
	Filter   Filter
	MetaHint string // e.g. active tag
}

func DefaultViews

func DefaultViews(now time.Time) []View

type ViewID

type ViewID string
const (
	ViewInbox     ViewID = "inbox"
	ViewToday     ViewID = "today"
	ViewUpcoming  ViewID = "upcoming"
	ViewCompleted ViewID = "completed"
	ViewTag       ViewID = "tag"
	ViewPriority  ViewID = "priority"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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