models

package
v0.0.0-...-e9fbfd2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID              string       `json:"id"`
	Title           string       `json:"title"`
	Article         string       `json:"article"`
	Image           string       `json:"image"`
	CreatedDate     time.Time    `json:"created_date"`
	UpdatedDate     time.Time    `json:"updated_date"`
	ArticleCategory BlogCategory `json:"article_category"`
}

func (*Article) CreateArticle

func (b *Article) CreateArticle(db *sql.DB) error

func (*Article) DeleteArticle

func (p *Article) DeleteArticle(db *sql.DB) error

func (*Article) GetArticle

func (b *Article) GetArticle(db *sql.DB, id string) error

func (*Article) GetArticles

func (p *Article) GetArticles(db *sql.DB) ([]Article, error)

func (*Article) UpdateArticle

func (b *Article) UpdateArticle(db *sql.DB) error

type BlogCategory

type BlogCategory struct {
	ID              string `json:"id"`
	ArticleCategory string `json:"category"`
}

func (*BlogCategory) CreateArticleCategory

func (b *BlogCategory) CreateArticleCategory(db *sql.DB) error

func (*BlogCategory) DeleteArticleCategory

func (b *BlogCategory) DeleteArticleCategory(db *sql.DB) error

func (*BlogCategory) GetArticleCategories

func (b *BlogCategory) GetArticleCategories(db *sql.DB) ([]BlogCategory, error)

func (*BlogCategory) GetArticleCategory

func (b *BlogCategory) GetArticleCategory(db *sql.DB, id string) error

func (*BlogCategory) Scan

func (a *BlogCategory) Scan(value interface{}) error

func (*BlogCategory) UpdateArticleCategory

func (b *BlogCategory) UpdateArticleCategory(db *sql.DB) error

func (BlogCategory) Value

func (bc BlogCategory) Value() (driver.Value, error)

type Category

type Category struct {
	ID           string `json:"id"`
	MainCategory string `json:"main_category"`
	SubCategory  string `json:"sub_category"` // Make subcategory ann array

}

func (*Category) CreateCategory

func (c *Category) CreateCategory(db *sql.DB) error

func (*Category) DeleteCategory

func (c *Category) DeleteCategory(db *sql.DB) error

func (*Category) GetCategories

func (c *Category) GetCategories(db *sql.DB) ([]Category, error)

func (*Category) GetCategory

func (c *Category) GetCategory(db *sql.DB, id string) error

func (*Category) Scan

func (a *Category) Scan(value interface{}) error

func (*Category) UpdateCategory

func (c *Category) UpdateCategory(db *sql.DB) error

func (Category) Value

func (a Category) Value() (driver.Value, error)

type Product

type Product struct {
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Price        float64   `json:"price"`
	Image        string    `json:"image"`
	Details      string    `json:"details"`
	Sizes        []string  `json:"sizes"`
	Colours      []string  `json:"colours"`
	VideoUrl     string    `json:"video_url"`
	Availability bool      `json:"availability"`
	Star         []int64   `json:"star"`
	Labels       []string  `json:"labels"`
	Discount     float64   `json:"discount"`
	Brands       []string  `json:"brands"`
	Categories   Category  `json:"categories"`
	CreatedDate  time.Time `json:"created_date"`
	UpdatedDate  time.Time `json:"updated_date"`
}

func (*Product) CreateProduct

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

func (*Product) DeleteProduct

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

func (*Product) GetProduct

func (p *Product) GetProduct(db *sql.DB, id string) error

func (*Product) GetProducts

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

func (*Product) ProductDiscount

func (p *Product) ProductDiscount(percent float64) *float64

func (*Product) UpdateProduct

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

type Vendor

type Vendor struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Email       string    `json:"email"`
	Phone       string    `json:"phone"`
	Address     string    `json:"address"`
	LogoUrl     string    `json:"logo_url"`
	CreatedDate time.Time `json:"created_date"`
	UpdatedDate time.Time `json:"updated_date"`
}

func (*Vendor) CreateVendor

func (v *Vendor) CreateVendor(db *sql.DB) error

func (*Vendor) DeleteVendor

func (v *Vendor) DeleteVendor(db *sql.DB) error

func (*Vendor) GetVendor

func (v *Vendor) GetVendor(db *sql.DB, id string) error

func (*Vendor) GetVendors

func (v *Vendor) GetVendors(db *sql.DB) ([]Vendor, error)

func (*Vendor) UpdateVendor

func (v *Vendor) UpdateVendor(db *sql.DB) error

Jump to

Keyboard shortcuts

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