goods

package
v0.0.0-...-d0a4871 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteGoodById

func DeleteGoodById(storage *storage.Storage, goodId int) error

func GetAll

func GetAll(storage *storage.Storage, active bool) (*[]Good, error)

func InsertGood

func InsertGood(storage *storage.Storage, data GoodInsert) error

func UpdateGoodById

func UpdateGoodById(storage *storage.Storage, goodId int, data GoodUpdate) error

Types

type Good

type Good struct {
	Id       int      `db:"id"`
	Name     string   `db:"name"`
	GoodType GoodType `db:"type"`
	Data     GoodData `db:"name"`
	Price    string   `db:"price"`
	Active   bool     `db:"active"`
}

func GetById

func GetById(storage *storage.Storage, goodId int) (*Good, error)

type GoodData

type GoodData string

type GoodInsert

type GoodInsert struct {
	Name     string
	GoodType GoodType
	Data     GoodData
	Price    string
}

type GoodType

type GoodType string
const (
	Laser     GoodType = "laser"
	Stand     GoodType = "stand"
	PowerUnit GoodType = "power_unit"
)

type GoodUpdate

type GoodUpdate struct {
	Name     string
	GoodType GoodType
	Data     GoodData
	Price    string
}

TODO: make fields optional

Jump to

Keyboard shortcuts

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