Documentation ¶
Index ¶
- func Migrate(db *gorm.DB) error
- func NewDatabase() (*gorm.DB, error)
- func RandomString(n int) string
- func UploadImage(file *multipart.File, authHeader string, imgName string) error
- type CategoryOut
- type CategoryServiceResponse
- type Group
- type GroupIn
- type GroupOut
- type GroupOutWithCategories
- type Product
- type ProductIn
- type ProductOut
- type QuantityOrderedResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabase ¶
func RandomString ¶
Types ¶
type CategoryOut ¶
type CategoryOut struct { ID uint `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` GroupID uint `json:"GroupId"` Deletable bool `json:"deletable"` }
func GetCategories ¶
func GetCategories(GroupID uint, categoryServiceURL string) ([]CategoryOut, error)
type CategoryServiceResponse ¶
type CategoryServiceResponse struct {
Categories []CategoryOut `json:"categories"`
}
type Group ¶
type Group struct { gorm.Model ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` Name string `gorm:"not null;unique" json:"name"` Description string `gorm:"" json:"description,omitempty"` }
func (*Group) OutWithCategories ¶
func (g *Group) OutWithCategories() GroupOutWithCategories
type GroupOut ¶
type GroupOut struct { ID uint `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` }
func GroupArrayOut ¶
type GroupOutWithCategories ¶
type GroupOutWithCategories struct { ID uint `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` Categories []CategoryOut `json:"Categories"` }
func GroupArrayOutWithCategories ¶
func GroupArrayOutWithCategories(groupModels []Group) []GroupOutWithCategories
type Product ¶
type Product struct { gorm.Model ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` Name string `gorm:"not null;unique" json:"name"` Description string `gorm:"" json:"description,omitempty"` Img string `gorm:"" json:"img,omitempty"` Price float32 `gorm:"not null" json:"price"` Discount int `gorm:"" json:"discount"` CategoryID uint `gorm:"not null" json:"categoryID"` }
func (*Product) IsDeletable ¶
func (*Product) Out ¶
func (p *Product) Out(authHeader string) ProductOut
type ProductIn ¶
type ProductOut ¶
type ProductOut struct { ID uint `json:"id"` Name string `json:"name"` Description string `json:"description,omitempty"` Img string `json:"img,omitempty"` Price float32 `json:"price"` Discount int `json:"discount"` CategoryID uint `json:"CategoryId"` Deletable bool `json:"deletable"` }
func ProductArrayOut ¶
func ProductArrayOut(models []Product, authHeader string) []ProductOut
type QuantityOrderedResponse ¶
type QuantityOrderedResponse struct {
Quantity uint `json:"quantity"`
}
Click to show internal directories.
Click to hide internal directories.