todo

package
v0.0.0-...-cb10448 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(db *sqlx.DB, id *int, title *string, desc *string, status *bool) (int, error)

Create adds a new To-Do to the database and returns its id

func Delete

func Delete(db *sqlx.DB, id int) (int, error)

Delete removes the To-Do that matches the supplied ID

func Update

func Update(db *sqlx.DB, id int, title *string, desc *string, status *bool) (int, error)

Update modifies the To-Do that matches the supplied ID

func Upsert

func Upsert(db *sqlx.DB, id int, title *string, desc *string, status *bool) (int, error)

Upsert will update a To-Do, if it exists, and create it otherwise. If a new To-Do is created, it returns the ID. Otherwise, it returns -1.

Types

type Todo

type Todo struct {
	ID          int       `db:"id"`
	Title       string    `db:"title"`
	Description string    `db:"description"`
	Status      bool      `db:"status"`
	Created     time.Time `db:"created"`
	Modified    time.Time `db:"modified"`
}

Todo is a task to be done

func GetAll

func GetAll(db *sqlx.DB) ([]Todo, error)

GetAll retrieves all To-Dos

func Retrieve

func Retrieve(db *sqlx.DB, id int) (*Todo, error)

Retrieve returns the To-Do with the supplied ID, if it exists

Jump to

Keyboard shortcuts

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