Documentation
¶
Index ¶
- type TaskDBHandler
- func (r TaskDBHandler) CheckTableExistance() (bool, error)
- func (r TaskDBHandler) CreateTable() error
- func (r TaskDBHandler) DeleteTask(rid uuid.UUID) error
- func (r TaskDBHandler) DropTable() error
- func (r TaskDBHandler) InsertTask(task *model.Task) (*model.Task, error)
- func (r TaskDBHandler) SelectAllTasks(lastID int, entries int) ([]*model.Task, error)
- func (r TaskDBHandler) SelectAllTasksBySearch(search string, lastID int, entries int) ([]*model.Task, error)
- func (r TaskDBHandler) SelectTask(rid uuid.UUID) (*model.Task, error)
- func (r TaskDBHandler) SelectTaskByKey(key string) (*model.Task, error)
- func (r TaskDBHandler) UpdateTask(task *model.Task) (*model.Task, error)
- type TaskDBHandlerFunctions
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 ¶
InsertTask inserts a new task record into the database.
func (TaskDBHandler) SelectAllTasks ¶
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 ¶
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 ¶
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.