repo

package
v0.0.0-...-bb1094a Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookListOptions

type BookListOptions struct {
	Status      string
	Author      string
	MinProgress int
	MinRating   float64
	Search      string
	SortBy      string
	SortOrder   string
	Limit       int
	Offset      int
}

BookListOptions defines options for listing books

type BookRepository

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

BookRepository provides database operations for books

func NewBookRepository

func NewBookRepository(db *sql.DB) *BookRepository

NewBookRepository creates a new book repository

func (*BookRepository) Count

func (r *BookRepository) Count(ctx context.Context, opts BookListOptions) (int64, error)

Count returns the number of books matching conditions

func (*BookRepository) Create

func (r *BookRepository) Create(ctx context.Context, book *models.Book) (int64, error)

Create stores a new book and returns its assigned ID

func (*BookRepository) Delete

func (r *BookRepository) Delete(ctx context.Context, id int64) error

Delete removes a book by ID

func (*BookRepository) Find

func (r *BookRepository) Find(ctx context.Context, conditions BookListOptions) ([]*models.Book, error)

Find retrieves books matching specific conditions

func (*BookRepository) FinishReading

func (r *BookRepository) FinishReading(ctx context.Context, id int64) error

FinishReading marks a book as finished

func (*BookRepository) Get

func (r *BookRepository) Get(ctx context.Context, id int64) (*models.Book, error)

Get retrieves a book by ID

func (*BookRepository) GetByAuthor

func (r *BookRepository) GetByAuthor(ctx context.Context, author string) ([]*models.Book, error)

GetByAuthor retrieves all books by a specific author

func (*BookRepository) GetFinished

func (r *BookRepository) GetFinished(ctx context.Context) ([]*models.Book, error)

GetFinished retrieves all finished books

func (*BookRepository) GetQueued

func (r *BookRepository) GetQueued(ctx context.Context) ([]*models.Book, error)

GetQueued retrieves all books in the queue

func (*BookRepository) GetReading

func (r *BookRepository) GetReading(ctx context.Context) ([]*models.Book, error)

GetReading retrieves all books currently being read

func (*BookRepository) List

func (r *BookRepository) List(ctx context.Context, opts BookListOptions) ([]*models.Book, error)

List retrieves books with optional filtering and sorting

func (*BookRepository) StartReading

func (r *BookRepository) StartReading(ctx context.Context, id int64) error

StartReading marks a book as started

func (*BookRepository) Update

func (r *BookRepository) Update(ctx context.Context, book *models.Book) error

Update modifies an existing book

func (*BookRepository) UpdateProgress

func (r *BookRepository) UpdateProgress(ctx context.Context, id int64, progress int) error

UpdateProgress updates the reading progress of a book

type MovieListOptions

type MovieListOptions struct {
	Status    string
	Year      int
	MinRating float64
	Search    string
	SortBy    string
	SortOrder string
	Limit     int
	Offset    int
}

MovieListOptions defines options for listing movies

type MovieRepository

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

MovieRepository provides database operations for movies

func NewMovieRepository

func NewMovieRepository(db *sql.DB) *MovieRepository

NewMovieRepository creates a new movie repository

func (*MovieRepository) Count

func (r *MovieRepository) Count(ctx context.Context, opts MovieListOptions) (int64, error)

Count returns the number of movies matching conditions

func (*MovieRepository) Create

func (r *MovieRepository) Create(ctx context.Context, movie *models.Movie) (int64, error)

Create stores a new movie and returns its assigned ID

func (*MovieRepository) Delete

func (r *MovieRepository) Delete(ctx context.Context, id int64) error

Delete removes a movie by ID

func (*MovieRepository) Find

func (r *MovieRepository) Find(ctx context.Context, conditions MovieListOptions) ([]*models.Movie, error)

Find retrieves movies matching specific conditions

func (*MovieRepository) Get

func (r *MovieRepository) Get(ctx context.Context, id int64) (*models.Movie, error)

Get retrieves a movie by ID

func (*MovieRepository) GetQueued

func (r *MovieRepository) GetQueued(ctx context.Context) ([]*models.Movie, error)

GetQueued retrieves all movies in the queue

func (*MovieRepository) GetWatched

func (r *MovieRepository) GetWatched(ctx context.Context) ([]*models.Movie, error)

GetWatched retrieves all watched movies

func (*MovieRepository) List

List retrieves movies with optional filtering and sorting

func (*MovieRepository) MarkWatched

func (r *MovieRepository) MarkWatched(ctx context.Context, id int64) error

MarkWatched marks a movie as watched

func (*MovieRepository) Update

func (r *MovieRepository) Update(ctx context.Context, movie *models.Movie) error

Update modifies an existing movie

type NoteListOptions

type NoteListOptions struct {
	Tags     []string
	Archived *bool
	Title    string
	Content  string
	Limit    int
	Offset   int
}

NoteListOptions defines filtering options for listing notes

type NoteRepository

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

NoteRepository provides database operations for notes

func NewNoteRepository

func NewNoteRepository(db *sql.DB) *NoteRepository

NewNoteRepository creates a new note repository

func (*NoteRepository) AddTag

func (r *NoteRepository) AddTag(ctx context.Context, id int64, tag string) error

AddTag adds a tag to a note

func (*NoteRepository) Archive

func (r *NoteRepository) Archive(ctx context.Context, id int64) error

Archive marks a note as archived

func (*NoteRepository) Create

func (r *NoteRepository) Create(ctx context.Context, note *models.Note) (int64, error)

Create stores a new note and returns its assigned ID

func (*NoteRepository) Delete

func (r *NoteRepository) Delete(ctx context.Context, id int64) error

Delete removes a note by its ID

func (*NoteRepository) Get

func (r *NoteRepository) Get(ctx context.Context, id int64) (*models.Note, error)

Get retrieves a note by its ID

func (*NoteRepository) GetActive

func (r *NoteRepository) GetActive(ctx context.Context) ([]*models.Note, error)

GetActive retrieves all non-archived notes

func (*NoteRepository) GetArchived

func (r *NoteRepository) GetArchived(ctx context.Context) ([]*models.Note, error)

GetArchived retrieves all archived notes

func (*NoteRepository) GetByTags

func (r *NoteRepository) GetByTags(ctx context.Context, tags []string) ([]*models.Note, error)

GetByTags retrieves notes that have any of the specified tags

func (*NoteRepository) GetByTitle

func (r *NoteRepository) GetByTitle(ctx context.Context, title string) ([]*models.Note, error)

GetByTitle searches for notes by title pattern

func (*NoteRepository) GetRecent

func (r *NoteRepository) GetRecent(ctx context.Context, limit int) ([]*models.Note, error)

GetRecent retrieves the most recently modified notes

func (*NoteRepository) List

func (r *NoteRepository) List(ctx context.Context, options NoteListOptions) ([]*models.Note, error)

List retrieves notes with optional filtering

func (*NoteRepository) RemoveTag

func (r *NoteRepository) RemoveTag(ctx context.Context, id int64, tag string) error

RemoveTag removes a tag from a note

func (*NoteRepository) SearchContent

func (r *NoteRepository) SearchContent(ctx context.Context, searchText string) ([]*models.Note, error)

SearchContent searches for notes containing the specified text in content

func (*NoteRepository) Unarchive

func (r *NoteRepository) Unarchive(ctx context.Context, id int64) error

Unarchive marks a note as not archived

func (*NoteRepository) Update

func (r *NoteRepository) Update(ctx context.Context, note *models.Note) error

Update modifies an existing note

type ProjectSummary

type ProjectSummary struct {
	Name      string `json:"name"`
	TaskCount int    `json:"task_count"`
}

ProjectSummary represents a project with its task count

type Repositories

type Repositories struct {
	Tasks       *TaskRepository
	Movies      *MovieRepository
	TV          *TVRepository
	Books       *BookRepository
	Notes       *NoteRepository
	TimeEntries *TimeEntryRepository
}

Repositories provides access to all resource repositories

func NewRepositories

func NewRepositories(db *sql.DB) *Repositories

NewRepositories creates a new set of repositories

type TVListOptions

type TVListOptions struct {
	Status    string
	Title     string
	Season    int
	MinRating float64
	Search    string
	SortBy    string
	SortOrder string
	Limit     int
	Offset    int
}

TVListOptions defines options for listing TV shows

type TVRepository

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

TVRepository provides database operations for TV shows

func NewTVRepository

func NewTVRepository(db *sql.DB) *TVRepository

NewTVRepository creates a new TV show repository

func (*TVRepository) Count

func (r *TVRepository) Count(ctx context.Context, opts TVListOptions) (int64, error)

Count returns the number of TV shows matching conditions

func (*TVRepository) Create

func (r *TVRepository) Create(ctx context.Context, tvShow *models.TVShow) (int64, error)

Create stores a new TV show and returns its assigned ID

func (*TVRepository) Delete

func (r *TVRepository) Delete(ctx context.Context, id int64) error

Delete removes a TV show by ID

func (*TVRepository) Find

func (r *TVRepository) Find(ctx context.Context, conditions TVListOptions) ([]*models.TVShow, error)

Find retrieves TV shows matching specific conditions

func (*TVRepository) Get

func (r *TVRepository) Get(ctx context.Context, id int64) (*models.TVShow, error)

Get retrieves a TV show by ID

func (*TVRepository) GetBySeason

func (r *TVRepository) GetBySeason(ctx context.Context, title string, season int) ([]*models.TVShow, error)

GetBySeason retrieves all episodes for a specific season of a show

func (*TVRepository) GetByTitle

func (r *TVRepository) GetByTitle(ctx context.Context, title string) ([]*models.TVShow, error)

GetByTitle retrieves all episodes for a specific TV show title

func (*TVRepository) GetQueued

func (r *TVRepository) GetQueued(ctx context.Context) ([]*models.TVShow, error)

GetQueued retrieves all TV shows in the queue

func (*TVRepository) GetWatched

func (r *TVRepository) GetWatched(ctx context.Context) ([]*models.TVShow, error)

GetWatched retrieves all watched TV shows

func (*TVRepository) GetWatching

func (r *TVRepository) GetWatching(ctx context.Context) ([]*models.TVShow, error)

GetWatching retrieves all TV shows currently being watched

func (*TVRepository) List

func (r *TVRepository) List(ctx context.Context, opts TVListOptions) ([]*models.TVShow, error)

List retrieves TV shows with optional filtering and sorting

func (*TVRepository) MarkWatched

func (r *TVRepository) MarkWatched(ctx context.Context, id int64) error

MarkWatched marks a TV show episode as watched

func (*TVRepository) StartWatching

func (r *TVRepository) StartWatching(ctx context.Context, id int64) error

StartWatching marks a TV show as currently being watched

func (*TVRepository) Update

func (r *TVRepository) Update(ctx context.Context, tvShow *models.TVShow) error

Update modifies an existing TV show

type TagSummary

type TagSummary struct {
	Name      string `json:"name"`
	TaskCount int    `json:"task_count"`
}

TagSummary represents a tag with its task count

type TaskListOptions

type TaskListOptions struct {
	Status    string
	Priority  string
	Project   string
	DueAfter  time.Time
	DueBefore time.Time
	Search    string
	SortBy    string
	SortOrder string
	Limit     int
	Offset    int
}

TaskListOptions defines options for listing tasks

type TaskRepository

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

TaskRepository provides database operations for tasks

func NewTaskRepository

func NewTaskRepository(db *sql.DB) *TaskRepository

NewTaskRepository creates a new task repository

func (*TaskRepository) Count

func (r *TaskRepository) Count(ctx context.Context, opts TaskListOptions) (int64, error)

Count returns the number of tasks matching conditions

func (*TaskRepository) Create

func (r *TaskRepository) Create(ctx context.Context, task *models.Task) (int64, error)

Create stores a new task and returns its assigned ID

func (*TaskRepository) Delete

func (r *TaskRepository) Delete(ctx context.Context, id int64) error

Delete removes a task by ID

func (*TaskRepository) Find

func (r *TaskRepository) Find(ctx context.Context, conditions TaskListOptions) ([]*models.Task, error)

Find retrieves tasks matching specific conditions

func (*TaskRepository) Get

func (r *TaskRepository) Get(ctx context.Context, id int64) (*models.Task, error)

Get retrieves a task by ID

func (*TaskRepository) GetAbandoned

func (r *TaskRepository) GetAbandoned(ctx context.Context) ([]*models.Task, error)

GetAbandoned retrieves all tasks with abandoned status

func (*TaskRepository) GetBlocked

func (r *TaskRepository) GetBlocked(ctx context.Context) ([]*models.Task, error)

GetBlocked retrieves all tasks with blocked status

func (*TaskRepository) GetByPriority

func (r *TaskRepository) GetByPriority(ctx context.Context, priority string) ([]*models.Task, error)

GetByPriority retrieves all tasks with a specific priority

We need special handling for empty priority by using raw SQL

func (*TaskRepository) GetByProject

func (r *TaskRepository) GetByProject(ctx context.Context, project string) ([]*models.Task, error)

GetByProject retrieves all tasks for a specific project

func (*TaskRepository) GetByUUID

func (r *TaskRepository) GetByUUID(ctx context.Context, uuid string) (*models.Task, error)

GetByUUID retrieves a task by UUID

func (*TaskRepository) GetCompleted

func (r *TaskRepository) GetCompleted(ctx context.Context) ([]*models.Task, error)

GetCompleted retrieves all completed tasks

func (*TaskRepository) GetDone

func (r *TaskRepository) GetDone(ctx context.Context) ([]*models.Task, error)

GetDone retrieves all tasks with done status

func (*TaskRepository) GetHighPriority

func (r *TaskRepository) GetHighPriority(ctx context.Context) ([]*models.Task, error)

GetHighPriority retrieves all high priority tasks

func (*TaskRepository) GetInProgress

func (r *TaskRepository) GetInProgress(ctx context.Context) ([]*models.Task, error)

GetInProgress retrieves all tasks with in-progress status

func (*TaskRepository) GetLowPriority

func (r *TaskRepository) GetLowPriority(ctx context.Context) ([]*models.Task, error)

GetLowPriority retrieves all low priority tasks

func (*TaskRepository) GetMediumPriority

func (r *TaskRepository) GetMediumPriority(ctx context.Context) ([]*models.Task, error)

GetMediumPriority retrieves all medium priority tasks

func (*TaskRepository) GetPending

func (r *TaskRepository) GetPending(ctx context.Context) ([]*models.Task, error)

GetPending retrieves all pending tasks

func (*TaskRepository) GetPrioritySummary

func (r *TaskRepository) GetPrioritySummary(ctx context.Context) (map[string]int64, error)

GetPrioritySummary returns a summary of tasks by priority

func (*TaskRepository) GetProjects

func (r *TaskRepository) GetProjects(ctx context.Context) ([]ProjectSummary, error)

GetProjects retrieves all unique project names with their task counts

func (*TaskRepository) GetStatusSummary

func (r *TaskRepository) GetStatusSummary(ctx context.Context) (map[string]int64, error)

GetStatusSummary returns a summary of tasks by status

func (*TaskRepository) GetTags

func (r *TaskRepository) GetTags(ctx context.Context) ([]TagSummary, error)

GetTags retrieves all unique tags with their task counts

func (*TaskRepository) GetTasksByTag

func (r *TaskRepository) GetTasksByTag(ctx context.Context, tag string) ([]*models.Task, error)

GetTasksByTag retrieves all tasks with a specific tag

func (*TaskRepository) GetTodo

func (r *TaskRepository) GetTodo(ctx context.Context) ([]*models.Task, error)

GetTodo retrieves all tasks with todo status

func (*TaskRepository) List

func (r *TaskRepository) List(ctx context.Context, opts TaskListOptions) ([]*models.Task, error)

List retrieves tasks with optional filtering and sorting

func (*TaskRepository) Update

func (r *TaskRepository) Update(ctx context.Context, task *models.Task) error

Update modifies an existing task

type TimeEntryRepository

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

TimeEntryRepository provides database operations for time entries

func NewTimeEntryRepository

func NewTimeEntryRepository(db *sql.DB) *TimeEntryRepository

NewTimeEntryRepository creates a new time entry repository

func (*TimeEntryRepository) Delete

func (r *TimeEntryRepository) Delete(ctx context.Context, id int64) error

Delete removes a time entry

func (*TimeEntryRepository) Get

Get retrieves a time entry by ID

func (*TimeEntryRepository) GetActiveByTaskID

func (r *TimeEntryRepository) GetActiveByTaskID(ctx context.Context, taskID int64) (*models.TimeEntry, error)

GetActiveByTaskID retrieves the active time entry for a task (if any)

func (*TimeEntryRepository) GetByDateRange

func (r *TimeEntryRepository) GetByDateRange(ctx context.Context, start, end time.Time) ([]*models.TimeEntry, error)

GetByDateRange retrieves time entries within a date range

func (*TimeEntryRepository) GetByTaskID

func (r *TimeEntryRepository) GetByTaskID(ctx context.Context, taskID int64) ([]*models.TimeEntry, error)

GetByTaskID retrieves all time entries for a task

func (*TimeEntryRepository) GetTotalTimeByTaskID

func (r *TimeEntryRepository) GetTotalTimeByTaskID(ctx context.Context, taskID int64) (time.Duration, error)

GetTotalTimeByTaskID calculates total time spent on a task

func (*TimeEntryRepository) Start

func (r *TimeEntryRepository) Start(ctx context.Context, taskID int64, description string) (*models.TimeEntry, error)

Start creates a new active time entry for a task

func (*TimeEntryRepository) Stop

Stop stops an active time entry by ID

func (*TimeEntryRepository) StopActiveByTaskID

func (r *TimeEntryRepository) StopActiveByTaskID(ctx context.Context, taskID int64) (*models.TimeEntry, error)

StopActiveByTaskID stops the active time entry for a task

Jump to

Keyboard shortcuts

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