model

package
v0.0.0-...-15901fa Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	ID    int     `json:"id"`
	Name  string  `json:"name"`
	Price float64 `json:"price"`
}

Product is a model for a product in json

func (*Product) ClearTable

func (p *Product) ClearTable(db *sql.DB) error

ClearTable has a function to clean table

func (*Product) CreateProduct

func (p *Product) CreateProduct(db *sql.DB) error

CreateProduct has a function to eate product

func (*Product) CreateTable

func (p *Product) CreateTable(db *sql.DB) error

CreateTable has a function to cxreate that table in database

func (*Product) DeleteProduct

func (p *Product) DeleteProduct(db *sql.DB) error

DeleteProduct has a functio to delete the product

func (*Product) GetProduct

func (p *Product) GetProduct(db *sql.DB) ([]Product, error)

GetProduct is a function to get one product

func (*Product) GetProducts

func (p *Product) GetProducts(db *sql.DB, start, count int) ([]Product, error)

GetProducts is a function to get all products

func (*Product) UpdateProduct

func (p *Product) UpdateProduct(db *sql.DB) ([]Product, error)

UpdateProduct has a specific dfunction than update product

Jump to

Keyboard shortcuts

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