db

package
v0.0.0-...-f7afd5f Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BrandTable = "brand"
View Source
const OfferTable = "offer"
View Source
const ProductTable = "product"
View Source
const StoreTable = "store"

Variables

This section is empty.

Functions

func CreateBrand

func CreateBrand(session db.Session, brand *models.Brand) (uint, error)

func CreateOffer

func CreateOffer(session db.Session, offer *models.Offer) (sql.Result, error)

func CreateProduct

func CreateProduct(session db.Session, product *models.Product) (id uint, err error)

func CreateStore

func CreateStore(session db.Session, store *models.Store) (uint, error)

func GetStore

func GetStore(session db.Session, id uint) (*models.Store, error)

Types

type Db

type Db = db.Session

func Connect

func Connect() (Db, error)

type OfferResult

type OfferResult struct {
	models.Offer
	Name               string `db:"product_name"`
	ProductDescription string `db:"product_description"`
	Picture            string `db:"product_picture"`
	StoreName          string `db:"store_name"`
	BrandName          string `db:"brand_name"`
}

func GetAvailableOffers

func GetAvailableOffers(
	session db.Session,
	page uint,
	limit uint,
) (offers []OfferResult, totalPages uint, err error)

func SearchAvailableOffers

func SearchAvailableOffers(
	session db.Session,
	term string,
	page uint,
	limit uint,
) (offers []OfferResult, totalPages uint, err error)

Jump to

Keyboard shortcuts

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