internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CategoriesListPgToEntity

func CategoriesListPgToEntity(c []*Category) []*entities.Category

func CategoryPgToEntity

func CategoryPgToEntity(c *Category) *entities.Category

func ImagePgToEntity

func ImagePgToEntity(image *Image) *entities.Image

func ImagesListPgToEntity

func ImagesListPgToEntity(images []Image) []*entities.Image

func ManufacturerPgToEntity

func ManufacturerPgToEntity(m *Manufacturer) *entities.Manufacturer

func ManufacturersListPgToEntity

func ManufacturersListPgToEntity(m []*Manufacturer) []*entities.Manufacturer

func Migrate

func Migrate(db *gorm.DB) error

func ProductPgToEntity

func ProductPgToEntity(c *Product) *entities.Product

func ProductsListPgToEntity

func ProductsListPgToEntity(p []*Product) []*entities.Product

Types

type Base

type Base struct {
	ID        string `gorm:"type:uuid"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Category

type Category struct {
	Base
	Name        string
	Description string
	ParentID    *string    `gorm:"type:uuid"`
	Children    []Category `gorm:"foreignkey:ParentID"`
	Products    []*Product `gorm:"many2many:product_categories;"`
	Order       int
	Image       *Image `gorm:"polymorphic:Owner;"`
}

func CategoryEntityToPg

func CategoryEntityToPg(e *entities.Category) *Category

type Image

type Image struct {
	ID        string `gorm:"type:uuid"`
	OwnerID   string `gorm:"type:uuid"`
	OwnerType string

	Extension string // File extension
	Order     int
}

func ImageEntityToPg

func ImageEntityToPg(e *entities.Image) *Image

func ImagesListEntityToPg

func ImagesListEntityToPg(images []*entities.Image) []Image

type Manufacturer

type Manufacturer struct {
	Base
	Name       string
	WebsiteURL string
	Image      *Image `gorm:"polymorphic:Owner;"`
}

func ManufacturerEntityToPg

func ManufacturerEntityToPg(e *entities.Manufacturer) *Manufacturer

type Product

type Product struct {
	Base
	Name             string
	DescriptionShort string
	DescriptionLong  string
	Price            int
	Categories       []Category `gorm:"many2many:product_categories;"`
	ManufacturerID   *string    `gorm:"type:uuid"`
	Status           string
	StockCount       int
	Images           []Image `gorm:"polymorphic:Owner;"`
}

func ProductEntityToPg

func ProductEntityToPg(e *entities.Product) *Product

Jump to

Keyboard shortcuts

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