model

package
v0.0.0-...-70c7f13 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID        uint           `gorm:"primaryKey;autoIncrement" json:"id"`
	Types     pq.StringArray `gorm:"type:text[]" json:"types"`
	TypeID    *int
	Type      Type           `gorm:"foreignKey:TypeID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"type"`
	Images    pq.StringArray `gorm:"type:text[]" json:"images"`
	Price     int            `json:"price"`
	Inventory int            `json:"inventory"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type Product

type Product struct {
	ID              uint       `gorm:"primaryKey;autoIncrement" json:"id"`
	Name            string     `json:"name"`
	Description     string     `json:"description"`
	Categories      []Category `gorm:"many2many:product_categories;" json:"categories"`
	Editor          string     `json:"editor"`
	Publisher       string     `json:"publisher"`
	PublicationDate string     `json:"publicaionDate"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
	DeletedAt       gorm.DeletedAt
}

type Type

type Type struct {
	ID        int    `gorm:"primaryKey" json:"id"`
	Name      string `gorm:"not null" json:"name"`
	ParentID  *int
	Parent    *Type `gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"parent"`
	Level     int   `json:"level"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

Jump to

Keyboard shortcuts

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