models

package
v0.0.0-...-26d6d38 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	Id int `gorm:"primarykey"`

	CreatedAt  time.Time    `gorm:"type:TIMESTAMP with time zone;not null"`
	ModifiedAt sql.NullTime `gorm:"type:TIMESTAMP with time zone;null"`
	DeletedAt  sql.NullTime `gorm:"type:TIMESTAMP with time zone;null"`

	CreatedBy  int            `gorm:"not null"`
	ModifiedBy *sql.NullInt64 `gorm:"null"`
	DeletedBy  *sql.NullInt64 `gorm:"null"`
}

func (*BaseModel) BeforeCreate

func (m *BaseModel) BeforeCreate(tx *gorm.DB) (err error)

func (*BaseModel) BeforeDelete

func (m *BaseModel) BeforeDelete(tx *gorm.DB) (err error)

func (*BaseModel) BeforeUpdate

func (m *BaseModel) BeforeUpdate(tx *gorm.DB) (err error)

type BaseTable

type BaseTable struct {
	Id   int    `gorm:"primarykey"`
	Name string `gorm:"not null"`
}

type Brands

type Brands struct {
	BaseModel
	BaseTable
}

type Categories

type Categories struct {
	BaseModel
	BaseTable
}

type Colors

type Colors struct {
	BaseModel
	BaseTable
}

type Materials

type Materials struct {
	BaseModel
	BaseTable
}

type Products

type Products struct {
	BaseModel
	BaseTable
	CategoryID int
	BrandID    int
	SizeID     int
	ColorID    int
	MaterialID int
	Price      float64

	Category Categories `gorm:"foreignKey:CategoryID"`
	Brand    Brands     `gorm:"foreignKey:BrandID"`
	Size     Sizes      `gorm:"foreignKey:SizeID"`
	Color    Colors     `gorm:"foreignKey:ColorID"`
	Material Materials  `gorm:"foreignKey:MaterialID"`
}

type Sizes

type Sizes struct {
	BaseModel
	BaseTable
}

Jump to

Keyboard shortcuts

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