internal

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 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

func ServiceCategoriesListPgToEntity added in v1.1.0

func ServiceCategoriesListPgToEntity(c []*ServiceCategory) []*entities.ServiceCategory

func ServicesListPgToEntity added in v1.1.0

func ServicesListPgToEntity(s []*Service) []*entities.Service

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

type Service added in v1.1.0

type Service struct {
	Base
	Name              string
	Description       string
	Price             int
	ServiceCategoryID string `gorm:"type:uuid;uniqueIndex:idx_service_category_order,priority:1"`
	Order             int    `gorm:"uniqueIndex:idx_service_category_order,priority:2"`
}

func ServiceEntityToPg added in v1.1.0

func ServiceEntityToPg(e *entities.Service) *Service

func (*Service) ToEntity added in v1.1.0

func (s *Service) ToEntity() *entities.Service

type ServiceCategory added in v1.1.0

type ServiceCategory struct {
	Base
	Name     string
	Order    int
	Services []Service
}

func ServiceCategoryEntityToPg added in v1.1.0

func ServiceCategoryEntityToPg(e *entities.ServiceCategory) *ServiceCategory

func (*ServiceCategory) ToEntity added in v1.1.0

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

Jump to

Keyboard shortcuts

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