Documentation
¶
Overview ¶
Package storage provides functionality to interact with a SQLite database to store task-related data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage represents the database storage.
func NewStorage ¶
NewStorage initializes a new database storage with the provided database file. It opens a connection to the SQLite database file specified by dbFile and creates a "tasks" table if it doesn't exist.
func (*Storage) AddTask ¶
AddTask adds a new task to the database storage. It takes a pointer to a util.Task as input and inserts the task details into the "tasks" table. It returns the ID of the newly inserted task and any error encountered.
func (*Storage) Close ¶
Close closes the database connection. It returns any error encountered during closing the connection.
func (*Storage) DeleteTask ¶
DeleteTask deletes a task with the specified ID from the database storage. It returns any error encountered during deletion.
func (*Storage) GetTask ¶
GetTask retrieves a task with the specified ID from the database storage. It returns a pointer to the retrieved task and any error encountered. If no task is found with the specified ID, it returns nil for the task and nil error.
func (*Storage) ListTasks ¶
ListTasks retrieves a list of all tasks stored in the database storage. It returns a slice containing all tasks and any error encountered during retrieval.
func (*Storage) UpdateTask ¶
UpdateTask updates an existing task in the database storage. It takes a pointer to a util.Task containing the updated task details and updates the corresponding task in the "tasks" table. It returns any error encountered during the update.