db

package
v0.0.0-...-73aec22 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatch = errors.New("no matching record")

ErrNoMatch is returned when we request a row that doesn't exist

Functions

This section is empty.

Types

type Database

type Database struct {
	Conn *sql.DB
}

Database represents a Database connection

func Connect

func Connect() (Database, error)

Connect opens a connection with Database

func (Database) DeleteItem

func (db Database) DeleteItem(itemID string) error

DeleteItem handles the deletion of an item by its ID

func (Database) GetItems

func (db Database) GetItems() (*models.ItemList, error)

GetItems returns all items in database

func (Database) NewItem

func (db Database) NewItem(item *models.Item) error

NewItem handles the insertion of a new item in the database

func (Database) SearchItemByID

func (db Database) SearchItemByID(itemID string) (models.Item, error)

SearchItemByID handles the searching of an item by its ID

func (Database) UpdateItem

func (db Database) UpdateItem(itemID string, itemData models.Item) (models.Item, error)

UpdateItem handles the update of an item by its ID

Jump to

Keyboard shortcuts

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