database

package
v0.0.0-...-1b0a4ae Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package database contains the database logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTodo

func AddTodo(t Todo)

AddTodo injects a todo into the database

func DeleteTodos

func DeleteTodos(id int)

DeleteTodos removes a todo from the database

func InitDb

func InitDb()

InitDb initializes the DB and creates the schema

Types

type Todo

type Todo struct {
	ID        int    `db:"ID"`
	Title     string `db:"TITLE"`
	Completed bool   `db:"COMPLETED"`
}

Todo struct must contain the attributes and they should match the schema

type TodoList

type TodoList []Todo

TodoList is a list of Todos

func GetTodos

func GetTodos() (TodoList, error)

GetTodos returns a List of Todos from the database

Jump to

Keyboard shortcuts

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