models

package
v0.0.0-...-02fbc85 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	ErrorCode    uint
	ErrorMessage string
}

type Category

type Category struct {
	gorm.Model

	ID string `gorm:"primaryKey; not null; unique_index"`
	CategoryBase
	Subcategories []Subcategory
	Products      []Product
}

func (Category) TableName

func (Category) TableName() string

TableName overrides the table name used by Category to `category`

type CategoryBase

type CategoryBase struct {
	CategoryName string `gorm:"not null; unique_index"`
	Description  string `gorm:"not null"`
	Active       bool   `gorm:"not null; default:true"`
}

type CategoryCreate

type CategoryCreate struct {
	CategoryBase
}

type CreditCard

type CreditCard struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	CreditCardBase
	Payments []Payment
}

func (CreditCard) TableName

func (CreditCard) TableName() string

TableName overrides the table name used by CredirCard to `credit_card`

type CreditCardBase

type CreditCardBase struct {
	Brand      string `gorm:"not null"`
	Number     string `gorm:"not null; unique_index"`
	CVV        string `gorm:"not null; unique_index"`
	MM         string `gorm:"not null"`
	YYYY       string `gorm:"not null"`
	CustomerID string `gorm:"not null; unique_index"`
}

type CreditCardCreate

type CreditCardCreate struct {
	CreditCardBase
}

type Customer

type Customer struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	CustomerBase
	CreditCards []CreditCard
	Logins      []Login
	Orders      []Order
}

func (Customer) TableName

func (Customer) TableName() string

TableName overrides the table name used by Customer to `customer`

type CustomerBase

type CustomerBase struct {
	Name       string    `gorm:"not null"`
	Email      string    `gorm:"not null; unique_index"`
	DNI        string    `gorm:"not null; unique_index"`
	Address    string    `gorm:"not null"`
	City       string    `gorm:"not null"`
	Birthday   time.Time `gorm:"not null"`
	PostalCode string    `gorm:"not null"`
	Country    string    `gorm:"not null"`
	Phone      string    `gorm:"not null"`
	UserName   string    `gorm:"not null"`
	Password   string    `gorm:"not null; unique_index"`
}

type CustomerCreate

type CustomerCreate struct {
	CustomerBase
}

type Login

type Login struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	LoginBase
}

func (Login) TableName

func (Login) TableName() string

TableName overrides the table name used by Login to `login`

type LoginBase

type LoginBase struct {
	CustomerID string `gorm:"not null; unique_index"`
}

type LoginCreate

type LoginCreate struct {
	LoginBase
}

type Order

type Order struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	OrderBase
	Payments []Payment
}

func (Order) TableName

func (Order) TableName() string

TableName overrides the table name used by Order to `order`

type OrderBase

type OrderBase struct {
	OrderDate      time.Time `gorm:"not null"`
	RequiredDate   time.Time `gorm:"not null"`
	ShippedDate    time.Time `gorm:"not null"`
	ShipName       string    `gorm:"not null"`
	ShipAddress    string    `gorm:"not null"`
	ShipCity       string    `gorm:"not null"`
	ShipPostalCode string    `gorm:"not null"`
	ShipCountry    string    `gorm:"not null"`
	CustomerID     string    `gorm:"not null; unique_index"`
	ShipperID      string    `gorm:"not null; unique_index"`
}

type OrderCreate

type OrderCreate struct {
	OrderBase
}

type OrderProduct

type OrderProduct struct {
	gorm.Model

	OrderProductBase
}

func (OrderProduct) TableName

func (OrderProduct) TableName() string

TableName overrides the table name used by OrderProduct to `order_product`

type OrderProductBase

type OrderProductBase struct {
	UnitPrice float32 `gorm:"not null"`
	Quantity  uint    `gorm:"not null"`
	Discount  float32 `gorm:"not null"`
	ProductID string  `gorm:"primaryKey; not null"`
	OrderID   string  `gorm:"primaryKey; not null"`
}

type OrderProductCreate

type OrderProductCreate struct {
	OrderProductBase
}

type Payment

type Payment struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	PaymentBase
}

func (Payment) TableName

func (Payment) TableName() string

TableName overrides the table name used by Payment to `payment`

type PaymentBase

type PaymentBase struct {
	OrderID      string `gorm:"not null; unique_index"`
	CreditCardID string `gorm:"not null; unique_index"`
}

type PaymentCreate

type PaymentCreate struct {
	PaymentBase
}

type Product

type Product struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	ProductBase
	Orders []Order `gorm:"many2many:order_product;"`
}

func (Product) TableName

func (Product) TableName() string

TableName overrides the table name used by Product to `product`

type ProductBase

type ProductBase struct {
	ProductName     string `gorm:"not null"`
	QuantityPerUnit string `gorm:"not null"`
	UnitsInStock    uint   `gorm:"not null"`
	UnitsOnOrder    uint   `gorm:"not null"`
	ReorderLevel    uint   `gorm:"not null"`
	Discontinued    bool   `gorm:"default:false"`
	Quantity        uint   `gorm:"not null"`
	SupplierID      string `gorm:"not null; unique_index"`
	CategoryID      string `gorm:"not null; unique_index"`
}

type ProductCreate

type ProductCreate struct {
	ProductBase
}

type Shipper

type Shipper struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	ShipperBase
	Orders []Order
}

func (Shipper) TableName

func (Shipper) TableName() string

TableName overrides the table name used by Shipper to `shipper`

type ShipperBase

type ShipperBase struct {
	CompanyName string `gorm:"not null; unique_index"`
	Phone       string `gorm:"not null"`
}

type ShipperCreate

type ShipperCreate struct {
	ShipperBase
}

type Subcategory

type Subcategory struct {
	gorm.Model

	ID string `gorm:"primaryKey; not null; unique_index"`
	SubcategoryBase
}

func (Subcategory) TableName

func (Subcategory) TableName() string

TableName overrides the table name used by Subcategory to `subcategory`

type SubcategoryBase

type SubcategoryBase struct {
	SubCategoryName string `gorm:"not null; unique_index"`
	Description     string `gorm:"not null"`
	Active          bool   `gorm:"not null; default:true"`
	CategoryID      string `gorm:"not null: unique_index"`
}

type SubcategoryCreate

type SubcategoryCreate struct {
	SubcategoryBase
}

type Supplier

type Supplier struct {
	gorm.Model
	ID string `gorm:"primaryKey; not null; unique_index"`
	SupplierBase
	Products []Product
}

func (Supplier) TableName

func (Supplier) TableName() string

TableName overrides the table name used by Supplier to `supplier`

type SupplierBase

type SupplierBase struct {
	CompanyName string `gorm:"not null"`
	Address     string `gorm:"not null"`
	City        string `gorm:"not null"`
	Country     string `gorm:"not null"`
	PostalCode  string `gorm:"not null"`
	Phone       string `gorm:"not null"`
	HomePage    string `gorm:"not null; unique_index"`
}

type SupplierCreate

type SupplierCreate struct {
	SupplierBase
}

type Tabler

type Tabler interface {
	TableName() string
}

Jump to

Keyboard shortcuts

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