Documentation
¶
Index ¶
- Constants
- func JoinCategories(id int) func(*gorm.DB) *gorm.DB
- func SetPivots(db *gorm.DB)
- type AccessToken
- type Category
- type Configuration
- type Coupon
- type Delivery
- type Image
- type Invoice
- type InvoiceItem
- type Payment
- type Product
- type Profile
- type ShoppingCart
- type ShoppingCartProduct
- type User
- type Zone
Constants ¶
View Source
const ( IMAGE_DISK_LOCAL = iota IMAGE_DISK_SEED )
Disks
View Source
const ( IMAGE_TYPE_PRODUCT = iota IMAGE_TYPE_PRODUCT_MAIN )
Types
View Source
const ( USER_TYPE_CLIENT = iota USER_TYPE_ADMIN )
User type constant
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶
type AccessToken struct {
UUID string `gorm:"primarykey;"`
Token string `gorm:"not null"`
UserID uint `gorm:"foreignKey;"`
UserAgent string `gorm:"not null"`
}
func (*AccessToken) String ¶
func (a *AccessToken) String() string
type Category ¶
type Category struct {
gorm.Model
Name string `gorm:"size:128;unique;"`
Status bool `gorm:"default:1;"`
ParentID *uint
Parent *Category
Children []Category `gorm:"foreignKey:ParentID"`
Products []Product
}
Category model
type Configuration ¶
type Image ¶
type Invoice ¶
type Invoice struct {
ID uint `gorm:"primarykey;"`
UserID uint `gorm:"foreingKey;not null;"`
Subtotal float64 `gorm:"not null;"`
IVA float64 `gorm:"not null;"`
Total float64 `gorm:"not null;"`
Type uint8 `gorm:"not null;"`
Status uint8 `gorm:"not null;"`
Items []InvoiceItem
Payments []Payment
User *User
CreatedAt time.Time
UpdatedAt time.Time
}
type InvoiceItem ¶
type Product ¶
type Product struct {
gorm.Model
Name string `gorm:"size:128;unique;not null;"`
Description string
Price float64 `gorm:"not null;"`
Stock uint
CategoryID uint
Category *Category
Images []Image `gorm:"polymorphic:Imageable;"`
}
Product model
type Profile ¶
type Profile struct {
UserID uint `gorm:"foreingKey;not null;"`
User *User
Name string `gorm:"size:64;not null;" json:"name" validate:"required,max=64"`
Lastname string `gorm:"size:64;not null;" json:"lastname" validate:"required,max=64"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
type ShoppingCart ¶
type ShoppingCartProduct ¶
type User ¶
type User struct {
gorm.Model
Email string `gorm:"size:64;unique;not null;" validate:"required,email,db_unique=users,max=64"`
Password string `gorm:"size:64;not null;" validate:"required,min=6,max=64"`
Status bool `gorm:"default:1;not null;"`
Type int `gorm:"default:0;size:1;not null;"`
Profile Profile `gorm:"constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"`
// Image *Image //`gorm:"polymorphic:Imageable;"`
// Invoices Invoice
Tokens []AccessToken
}
User model
func (*User) CreateAccressToken ¶
CreateAccressToken creates and store a new access token for the calling user
Click to show internal directories.
Click to hide internal directories.