db

package
v0.0.0-...-d12f080 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DB_PATH string = "items.db"

Variables

This section is empty.

Functions

func DeleteItem

func DeleteItem(id int64) (bool, error)

func Initialize

func Initialize()

func NewItem

func NewItem(
	name string,
	price float64,
	category int64,
) (int64, error)

func UpdateItem

func UpdateItem(item Item) error

Types

type Category

type Category struct {
	Id   int
	Name string
}

func GetCategory

func GetCategory(id int64) (*Category, error)

type Item

type Item struct {
	Id       int64   `json:"id"`
	Sku      string  `json:"sku"`
	Name     string  `json:"name"`
	Price    float64 `json:"price"`
	Category int64   `json:"category"`
}

func GetItem

func GetItem(id int64) (*Item, error)

func GetItemList

func GetItemList(
	page Page,
	filters ItemFilters,
) ([]Item, error)

type ItemFilters

type ItemFilters struct {
	LowerPrice *float64
	UpperPrice *float64
	Category   *int64
}

type Page

type Page struct {
	Number int
	Size   int
}

func DefaultPage

func DefaultPage() Page

Jump to

Keyboard shortcuts

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