database

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskDBHandler

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

TaskDBHandler implements TaskDBHandlerFunctions and holds the database connection.

func NewTaskDBHandler

func NewTaskDBHandler(dbConnection *helper.Database, withTableDrop bool) (*TaskDBHandler, error)

NewTaskDBHandler creates a new instance of TaskDBHandler. It initializes the database connection and optionally drops existing tables. If withTableDrop is true, it will drop the existing task table before creating a new one

func (TaskDBHandler) CheckTableExistance

func (r TaskDBHandler) CheckTableExistance() (bool, error)

CheckTableExistance checks if the 'task' table exists in the database. It returns true if the table exists, otherwise false.

func (TaskDBHandler) CreateTable

func (r TaskDBHandler) CreateTable() error

CreateTable creates the 'task' table in the database. If the table already exists, it does not create it again.

func (TaskDBHandler) DeleteTask

func (r TaskDBHandler) DeleteTask(rid uuid.UUID) error

DeleteTask deletes a task record from the database by RID.

func (TaskDBHandler) DropTable

func (r TaskDBHandler) DropTable() error

DropTable drops the 'task' table from the database.

func (TaskDBHandler) InsertTask

func (r TaskDBHandler) InsertTask(task *model.Task) (*model.Task, error)

InsertTask inserts a new task record into the database.

func (TaskDBHandler) SelectAllTasks

func (r TaskDBHandler) SelectAllTasks(lastID int, entries int) ([]*model.Task, error)

SelectAllTasks retrieves all tasks from the database with pagination. lastID is the ID of the last task from the previous page (0 for first page) entries is the maximum number of tasks to return

func (TaskDBHandler) SelectAllTasksBySearch

func (r TaskDBHandler) SelectAllTasksBySearch(search string, lastID int, entries int) ([]*model.Task, error)

SelectAllTasksBySearch retrieves tasks matching the search query with pagination. search is the search string to match against rid, key, name, and description lastID is the ID of the last task from the previous page (0 for first page) entries is the maximum number of tasks to return

func (TaskDBHandler) SelectTask

func (r TaskDBHandler) SelectTask(rid uuid.UUID) (*model.Task, error)

SelectTask retrieves a task by RID from the database.

func (TaskDBHandler) SelectTaskByKey

func (r TaskDBHandler) SelectTaskByKey(key string) (*model.Task, error)

SelectTaskByKey retrieves a task by key from the database.

func (TaskDBHandler) UpdateTask

func (r TaskDBHandler) UpdateTask(task *model.Task) (*model.Task, error)

UpdateTask updates an existing task record in the database.

type TaskDBHandlerFunctions

type TaskDBHandlerFunctions interface {
	CheckTableExistance() (bool, error)
	CreateTable() error
	DropTable() error
	InsertTask(task *model.Task) (*model.Task, error)
	UpdateTask(task *model.Task) (*model.Task, error)
	DeleteTask(rid uuid.UUID) error
	SelectTask(rid uuid.UUID) (*model.Task, error)
	SelectTaskByKey(key string) (*model.Task, error)
	SelectAllTasks(lastID int, entries int) ([]*model.Task, error)
	SelectAllTasksBySearch(search string, lastID int, entries int) ([]*model.Task, error)
}

TaskDBHandlerFunctions defines the interface for Task database operations.

Jump to

Keyboard shortcuts

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