models

package
v0.0.0-...-065b4f8 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusTodo       = "todo"
	StatusInProgress = "in-progress"
	StatusBlocked    = "blocked"
	StatusDone       = "done"
	StatusAbandoned  = "abandoned"
	StatusPending    = "pending"
	StatusCompleted  = "completed"
	StatusDeleted    = "deleted"
)

TODO: Use TaskStatus

View Source
const (
	PriorityHigh   = "High"
	PriorityMedium = "Medium"
	PriorityLow    = "Low"
)

TODO: Use TaskPriority

View Source
const (
	PriorityNumericMin = 1
	PriorityNumericMax = 5
)

TODO: Use TaskWeight

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID              int64     `json:"id"`
	Title           string    `json:"title"`
	Artist          string    `json:"artist"`
	Genre           string    `json:"genre,omitempty"`
	ReleaseYear     int       `json:"release_year,omitempty"`
	Tracks          []string  `json:"tracks,omitempty"`
	DurationSeconds int       `json:"duration_seconds,omitempty"`
	AlbumArtPath    string    `json:"album_art_path,omitempty"`
	Rating          int       `json:"rating,omitempty"`
	Created         time.Time `json:"created"`
	Modified        time.Time `json:"modified"`
}

Album represents a music album

func (*Album) GetCreatedAt

func (a *Album) GetCreatedAt() time.Time

func (*Album) GetID

func (a *Album) GetID() int64

func (*Album) GetTableName

func (a *Album) GetTableName() string

func (*Album) GetUpdatedAt

func (a *Album) GetUpdatedAt() time.Time

func (*Album) HasRating

func (a *Album) HasRating() bool

HasRating returns true if the album has a rating set

func (*Album) IsValidRating

func (a *Album) IsValidRating() bool

IsValidRating returns true if the rating is between 1 and 5

func (*Album) MarshalTracks

func (a *Album) MarshalTracks() (string, error)

MarshalTracks converts tracks slice to JSON string for database storage

func (*Album) SetCreatedAt

func (a *Album) SetCreatedAt(time time.Time)

func (*Album) SetID

func (a *Album) SetID(id int64)

func (*Album) SetUpdatedAt

func (a *Album) SetUpdatedAt(time time.Time)

func (*Album) UnmarshalTracks

func (a *Album) UnmarshalTracks(data string) error

UnmarshalTracks converts JSON string from database to tracks slice

type Article

type Article struct {
	ID           int64     `json:"id"`
	URL          string    `json:"url"`
	Title        string    `json:"title"`
	Author       string    `json:"author,omitempty"`
	Date         string    `json:"date,omitempty"`
	MarkdownPath string    `json:"markdown_path"`
	HTMLPath     string    `json:"html_path"`
	Created      time.Time `json:"created"`
	Modified     time.Time `json:"modified"`
}

Article represents a parsed article from a web URL

func (*Article) GetCreatedAt

func (a *Article) GetCreatedAt() time.Time

func (*Article) GetID

func (a *Article) GetID() int64

func (*Article) GetTableName

func (a *Article) GetTableName() string

func (*Article) GetUpdatedAt

func (a *Article) GetUpdatedAt() time.Time

func (*Article) HasAuthor

func (a *Article) HasAuthor() bool

HasAuthor returns true if the article has an author

func (*Article) HasDate

func (a *Article) HasDate() bool

HasDate returns true if the article has a date

func (*Article) IsValidURL

func (a *Article) IsValidURL() bool

IsValidURL returns true if the article has parseable URL

func (*Article) SetCreatedAt

func (a *Article) SetCreatedAt(time time.Time)

func (*Article) SetID

func (a *Article) SetID(id int64)

func (*Article) SetUpdatedAt

func (a *Article) SetUpdatedAt(time time.Time)

type Book

type Book struct {
	ID       int64      `json:"id"`
	Title    string     `json:"title"`
	Author   string     `json:"author,omitempty"`
	Status   string     `json:"status"`   // queued, reading, finished, removed
	Progress int        `json:"progress"` // percentage 0-100
	Pages    int        `json:"pages,omitempty"`
	Rating   float64    `json:"rating,omitempty"`
	Notes    string     `json:"notes,omitempty"`
	Added    time.Time  `json:"added"`
	Started  *time.Time `json:"started,omitempty"`
	Finished *time.Time `json:"finished,omitempty"`
}

Book represents a book in the reading list

func (*Book) GetCompletionTime

func (b *Book) GetCompletionTime() *time.Time

GetCompletionTime returns when the book was finished

func (*Book) GetCreatedAt

func (b *Book) GetCreatedAt() time.Time

func (*Book) GetID

func (b *Book) GetID() int64

func (*Book) GetProgress

func (b *Book) GetProgress() int

GetProgress returns the reading progress percentage (0-100)

func (*Book) GetStatus

func (b *Book) GetStatus() string

GetStatus returns the current status of the book

func (*Book) GetTableName

func (b *Book) GetTableName() string

func (*Book) GetUpdatedAt

func (b *Book) GetUpdatedAt() time.Time

func (*Book) IsCompleted

func (b *Book) IsCompleted() bool

IsCompleted returns true if the book has been finished

func (*Book) IsFinished

func (b *Book) IsFinished() bool

IsFinished returns true if the book has been finished

func (*Book) IsQueued

func (b *Book) IsQueued() bool

IsQueued returns true if the book is in the queue

func (*Book) IsReading

func (b *Book) IsReading() bool

IsReading returns true if the book is currently being read

func (*Book) ProgressPercent

func (b *Book) ProgressPercent() int

ProgressPercent returns the reading progress as a percentage

func (*Book) SetCreatedAt

func (b *Book) SetCreatedAt(time time.Time)

func (*Book) SetID

func (b *Book) SetID(id int64)

func (*Book) SetProgress

func (b *Book) SetProgress(progress int) error

SetProgress sets the reading progress percentage (0-100)

func (*Book) SetUpdatedAt

func (b *Book) SetUpdatedAt(time time.Time)

func (*Book) ValidStatuses

func (b *Book) ValidStatuses() []string

ValidStatuses returns all valid status values for a book

type Completable

type Completable interface {
	Stateful
	IsCompleted() bool
	GetCompletionTime() *time.Time
}

Completable represents media that can be marked as completed/finished/watched. It tracks completion timestamps for media consumption.

Implemented by: Book (finished), Movie (watched), TVShow (watched)

type Model

type Model interface {
	GetID() int64             // GetID returns the primary key identifier
	SetID(id int64)           // SetID sets the primary key identifier
	GetTableName() string     // GetTableName returns the database table name for this model
	GetCreatedAt() time.Time  // GetCreatedAt returns when the model was created
	SetCreatedAt(t time.Time) // SetCreatedAt sets when the model was created
	GetUpdatedAt() time.Time  // GetUpdatedAt returns when the model was last updated
	SetUpdatedAt(t time.Time) // SetUpdatedAt sets when the model was last updated
}

Model defines the common interface that all domain models must implement

type Movie

type Movie struct {
	ID      int64      `json:"id"`
	Title   string     `json:"title"`
	Year    int        `json:"year,omitempty"`
	Status  string     `json:"status"` // queued, watched, removed
	Rating  float64    `json:"rating,omitempty"`
	Notes   string     `json:"notes,omitempty"`
	Added   time.Time  `json:"added"`
	Watched *time.Time `json:"watched,omitempty"`
}

Movie represents a movie in the watch queue

func (*Movie) GetCompletionTime

func (m *Movie) GetCompletionTime() *time.Time

GetCompletionTime returns when the movie was watched

func (*Movie) GetCreatedAt

func (m *Movie) GetCreatedAt() time.Time

func (*Movie) GetID

func (m *Movie) GetID() int64

func (*Movie) GetStatus

func (m *Movie) GetStatus() string

GetStatus returns the current status of the movie

func (*Movie) GetTableName

func (m *Movie) GetTableName() string

func (*Movie) GetUpdatedAt

func (m *Movie) GetUpdatedAt() time.Time

func (*Movie) IsCompleted

func (m *Movie) IsCompleted() bool

IsCompleted returns true if the movie has been watched

func (*Movie) IsQueued

func (m *Movie) IsQueued() bool

IsQueued returns true if the movie is in the queue

func (*Movie) IsWatched

func (m *Movie) IsWatched() bool

IsWatched returns true if the movie has been watched

func (*Movie) SetCreatedAt

func (m *Movie) SetCreatedAt(time time.Time)

func (*Movie) SetID

func (m *Movie) SetID(id int64)

func (*Movie) SetUpdatedAt

func (m *Movie) SetUpdatedAt(time time.Time)

func (*Movie) ValidStatuses

func (m *Movie) ValidStatuses() []string

ValidStatuses returns all valid status values for a movie

type Note

type Note struct {
	ID          int64      `json:"id"`
	Title       string     `json:"title"`
	Content     string     `json:"content"`
	Tags        []string   `json:"tags,omitempty"`
	Archived    bool       `json:"archived"`
	Created     time.Time  `json:"created"`
	Modified    time.Time  `json:"modified"`
	FilePath    string     `json:"file_path,omitempty"`
	LeafletRKey *string    `json:"leaflet_rkey,omitempty"` // Leaflet record key
	LeafletCID  *string    `json:"leaflet_cid,omitempty"`  // Leaflet content identifier
	PublishedAt *time.Time `json:"published_at,omitempty"` // Publication timestamp
	IsDraft     bool       `json:"is_draft"`               // Draft vs published status
}

Note represents a markdown note

func (*Note) GetCreatedAt

func (n *Note) GetCreatedAt() time.Time

func (*Note) GetID

func (n *Note) GetID() int64

func (*Note) GetTableName

func (n *Note) GetTableName() string

func (*Note) GetUpdatedAt

func (n *Note) GetUpdatedAt() time.Time

func (*Note) HasLeafletAssociation

func (n *Note) HasLeafletAssociation() bool

HasLeafletAssociation returns true if the note is associated with a leaflet document

func (*Note) IsArchived

func (n *Note) IsArchived() bool

IsArchived returns true if the note is archived

func (*Note) IsPublished

func (n *Note) IsPublished() bool

IsPublished returns true if the note is published on leaflet (not a draft)

func (*Note) MarshalTags

func (n *Note) MarshalTags() (string, error)

MarshalTags converts tags slice to JSON string for database storage

func (*Note) SetCreatedAt

func (n *Note) SetCreatedAt(time time.Time)

func (*Note) SetID

func (n *Note) SetID(id int64)

func (*Note) SetUpdatedAt

func (n *Note) SetUpdatedAt(time time.Time)

func (*Note) UnmarshalTags

func (n *Note) UnmarshalTags(data string) error

UnmarshalTags converts JSON string from database to tags slice

type Progressable

type Progressable interface {
	Completable
	GetProgress() int
	SetProgress(progress int) error
}

Progressable represents media with measurable progress tracking

Implemented by: Book (percentage-based reading progress)

type Queueable

type Queueable interface {
	Stateful
	IsQueued() bool
}

Queueable represents media that can be queued for later consumption

Implemented by: Book, Movie, TVShow

type RRule

type RRule string

RRule represents a recurrence rule (RFC 5545). Example: "FREQ=DAILY;INTERVAL=1" or "FREQ=WEEKLY;BYDAY=MO,WE,FR".

type Stateful

type Stateful interface {
	GetStatus() string
	ValidStatuses() []string
}

Stateful represents entities with status management behavior

Implemented by: Book, Movie, TVShow, Task

type TVShow

type TVShow struct {
	ID          int64      `json:"id"`
	Title       string     `json:"title"`
	Season      int        `json:"season,omitempty"`
	Episode     int        `json:"episode,omitempty"`
	Status      string     `json:"status"` // queued, watching, watched, removed
	Rating      float64    `json:"rating,omitempty"`
	Notes       string     `json:"notes,omitempty"`
	Added       time.Time  `json:"added"`
	LastWatched *time.Time `json:"last_watched,omitempty"`
}

TVShow represents a TV show in the watch queue

func (*TVShow) GetCompletionTime

func (tv *TVShow) GetCompletionTime() *time.Time

GetCompletionTime returns when the TV show was last watched

func (*TVShow) GetCreatedAt

func (tv *TVShow) GetCreatedAt() time.Time

func (*TVShow) GetID

func (tv *TVShow) GetID() int64

func (*TVShow) GetStatus

func (tv *TVShow) GetStatus() string

GetStatus returns the current status of the TV show

func (*TVShow) GetTableName

func (tv *TVShow) GetTableName() string

func (*TVShow) GetUpdatedAt

func (tv *TVShow) GetUpdatedAt() time.Time

func (*TVShow) IsCompleted

func (tv *TVShow) IsCompleted() bool

IsCompleted returns true if the TV show has been watched

func (*TVShow) IsQueued

func (tv *TVShow) IsQueued() bool

IsQueued returns true if the TV show is in the queue

func (*TVShow) IsWatched

func (tv *TVShow) IsWatched() bool

IsWatched returns true if the TV show has been watched

func (*TVShow) IsWatching

func (tv *TVShow) IsWatching() bool

IsWatching returns true if the TV show is currently being watched

func (*TVShow) SetCreatedAt

func (tv *TVShow) SetCreatedAt(time time.Time)

func (*TVShow) SetID

func (tv *TVShow) SetID(id int64)

func (*TVShow) SetUpdatedAt

func (tv *TVShow) SetUpdatedAt(time time.Time)

func (*TVShow) ValidStatuses

func (tv *TVShow) ValidStatuses() []string

ValidStatuses returns all valid status values for a TV show

type Task

type Task struct {
	ID          int64      `json:"id"`
	UUID        string     `json:"uuid"`
	Description string     `json:"description"`
	Status      string     `json:"status"`             // pending, completed, deleted
	Priority    string     `json:"priority,omitempty"` // A-Z or empty
	Project     string     `json:"project,omitempty"`
	Context     string     `json:"context,omitempty"`
	Tags        []string   `json:"tags,omitempty"`
	Due         *time.Time `json:"due,omitempty"`
	Entry       time.Time  `json:"entry"`
	Modified    time.Time  `json:"modified"`
	End         *time.Time `json:"end,omitempty"`   // Completion time
	Start       *time.Time `json:"start,omitempty"` // When the task was started
	Annotations []string   `json:"annotations,omitempty"`
	Recur       RRule      `json:"recur,omitempty"`
	Until       *time.Time `json:"until,omitempty"`       // End date for recurrence
	ParentUUID  *string    `json:"parent_uuid,omitempty"` // ID of parent/template task
	DependsOn   []string   `json:"depends_on,omitempty"`  // IDs of tasks this task depends on
}

Task represents a task item with TaskWarrior-inspired fields

func (*Task) Blocks

func (t *Task) Blocks(other *Task) bool

Blocks checks if this task blocks another given task.

func (*Task) GetCreatedAt

func (t *Task) GetCreatedAt() time.Time

func (*Task) GetID

func (t *Task) GetID() int64

func (*Task) GetPriorityWeight

func (t *Task) GetPriorityWeight() int

GetPriorityWeight returns a numeric weight for sorting priorities. A higher number = higher priority

func (*Task) GetStatus

func (t *Task) GetStatus() string

GetStatus returns the current status of the task

func (*Task) GetTableName

func (t *Task) GetTableName() string

func (*Task) GetUpdatedAt

func (t *Task) GetUpdatedAt() time.Time

func (*Task) HasDependencies

func (t *Task) HasDependencies() bool

HasDependencies returns true if the task depends on other tasks.

func (*Task) HasDueDate

func (t *Task) HasDueDate() bool

HasDueDate returns true if the task has a due date set.

func (*Task) HasPriority

func (t *Task) HasPriority() bool

HasPriority returns true if the task has a priority set

func (*Task) IsAbandoned

func (t *Task) IsAbandoned() bool

func (*Task) IsBlocked

func (t *Task) IsBlocked() bool

func (*Task) IsCompleted

func (t *Task) IsCompleted() bool

IsCompleted returns true if the task is marked as completed

func (*Task) IsDeleted

func (t *Task) IsDeleted() bool

IsDeleted returns true if the task is deleted

func (*Task) IsDone

func (t *Task) IsDone() bool

func (*Task) IsInProgress

func (t *Task) IsInProgress() bool

func (*Task) IsOverdue

func (t *Task) IsOverdue(now time.Time) bool

IsOverdue returns true if the task is overdue.

func (*Task) IsPending

func (t *Task) IsPending() bool

IsPending returns true if the task is pending

func (*Task) IsRecurExpired

func (t *Task) IsRecurExpired(now time.Time) bool

IsRecurExpired checks if the recurrence has an end (until) date and is past it.

func (*Task) IsRecurring

func (t *Task) IsRecurring() bool

IsRecurring returns true if the task has recurrence defined.

func (*Task) IsStarted

func (t *Task) IsStarted() bool

IsStarted returns true if the task has a start time set.

func (*Task) IsTodo

func (t *Task) IsTodo() bool

func (*Task) IsValidPriority

func (t *Task) IsValidPriority() bool

IsValidPriority returns true if the priority is valid (text-based or numeric string)

func (*Task) IsValidStatus

func (t *Task) IsValidStatus() bool

IsValidStatus returns true if the status is one of the defined valid statuses

func (*Task) MarshalAnnotations

func (t *Task) MarshalAnnotations() (string, error)

MarshalAnnotations converts annotations slice to JSON string for database storage

func (*Task) MarshalTags

func (t *Task) MarshalTags() (string, error)

MarshalTags converts tags slice to JSON string for database storage

func (*Task) SetCreatedAt

func (t *Task) SetCreatedAt(time time.Time)

func (*Task) SetID

func (t *Task) SetID(id int64)

func (*Task) SetUpdatedAt

func (t *Task) SetUpdatedAt(time time.Time)

func (*Task) UnmarshalAnnotations

func (t *Task) UnmarshalAnnotations(data string) error

UnmarshalAnnotations converts JSON string from database to annotations slice

func (*Task) UnmarshalTags

func (t *Task) UnmarshalTags(data string) error

UnmarshalTags converts JSON string from database to tags slice

func (*Task) Urgency

func (t *Task) Urgency(now time.Time) float64

Urgency computes a score based on priority, due date, and tags. This can be expanded later with weights.

func (*Task) ValidStatuses

func (t *Task) ValidStatuses() []string

ValidStatuses returns all valid status values for a task

type TaskPriority

type TaskPriority string

type TaskStatus

type TaskStatus string

type TaskWeight

type TaskWeight int

type TimeEntry

type TimeEntry struct {
	ID              int64      `json:"id"`
	TaskID          int64      `json:"task_id"`
	StartTime       time.Time  `json:"start_time"`
	EndTime         *time.Time `json:"end_time,omitempty"`
	DurationSeconds int64      `json:"duration_seconds,omitempty"`
	Description     string     `json:"description,omitempty"`
	Created         time.Time  `json:"created"`
	Modified        time.Time  `json:"modified"`
}

TimeEntry represents a time tracking entry for a task

func (*TimeEntry) GetCreatedAt

func (te *TimeEntry) GetCreatedAt() time.Time

func (*TimeEntry) GetDuration

func (te *TimeEntry) GetDuration() time.Duration

GetDuration returns the duration of the time entry

func (*TimeEntry) GetID

func (te *TimeEntry) GetID() int64

func (*TimeEntry) GetTableName

func (te *TimeEntry) GetTableName() string

func (*TimeEntry) GetUpdatedAt

func (te *TimeEntry) GetUpdatedAt() time.Time

func (*TimeEntry) IsActive

func (te *TimeEntry) IsActive() bool

IsActive returns true if the time entry is currently active (not stopped)

func (*TimeEntry) SetCreatedAt

func (te *TimeEntry) SetCreatedAt(time time.Time)

func (*TimeEntry) SetID

func (te *TimeEntry) SetID(id int64)

func (*TimeEntry) SetUpdatedAt

func (te *TimeEntry) SetUpdatedAt(time time.Time)

func (*TimeEntry) Stop

func (te *TimeEntry) Stop()

Stop stops the time entry and calculates duration

Jump to

Keyboard shortcuts

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