internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: GPL-3.0 Imports: 6 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 ImagesListPgToEntity

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

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

func (*Category) ToEntity added in v0.3.0

func (c *Category) ToEntity() *entities.Category

type ConditionsGroup added in v0.5.0

type ConditionsGroup struct {
	// contains filtered or unexported fields
}

func NewConditionsGroup added in v0.5.0

func NewConditionsGroup(condition string, args ...any) *ConditionsGroup

func (*ConditionsGroup) AddANDCondition added in v0.5.0

func (g *ConditionsGroup) AddANDCondition(condition string, args ...any)

func (*ConditionsGroup) AddORCondition added in v0.5.0

func (g *ConditionsGroup) AddORCondition(condition string, args ...any)

func (*ConditionsGroup) GetGORMConds added in v0.5.0

func (g *ConditionsGroup) GetGORMConds() []any

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

func (*Image) ToEntity added in v0.3.0

func (image *Image) ToEntity() *entities.Image

type Manufacturer

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

func ManufacturerEntityToPg

func ManufacturerEntityToPg(e *entities.Manufacturer) *Manufacturer

func (*Manufacturer) ToEntity added in v0.3.0

func (m *Manufacturer) ToEntity() *entities.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