Documentation
¶
Index ¶
- Constants
- func FetchOrder(id uint) (order *Order, err *DbErr)
- func GetAdmin() (user *User, err *DbErr)
- func HashPassword(pass string) string
- func Init(externalDb *gorm.DB) error
- type Activity
- type DbErr
- func Create[T any](model *T) *DbErr
- func Delete(model any) (e *DbErr)
- func DeleteById(id uint, model any) (e *DbErr)
- func FetchAllOrders() (orders *[]Order, err *DbErr)
- func FindById[T any](id uint) (model *T, e *DbErr)
- func FindByIdPreload[T any](id uint, preload string) (model *T, e *DbErr)
- func GetActivitiesByUserId(id uint) (actitivies *[]Activity, herr *DbErr)
- func GetAll[T any](sel string, con ...any) (models *[]T, e *DbErr)
- func GetAllPreload[T any](sel, preload string, con ...any) (models *[]T, e *DbErr)
- func Login(u *User) *DbErr
- func SeenActivities(id uint) *DbErr
- func UpdateById[T any](id uint, model *T) (e *DbErr)
- func UpdateStatus[T any](id uint, status string) (e *DbErr)
- type Order
- type Product
- type Refund
- type Task
- type User
Constants ¶
View Source
const ( TASK_INPROGRESS = "IN-PROGRESS" TASK_DONE = "DONE" TASK_CANCELED = "CANCELED" TASK_BROWSE = "BROWSE" ACTION_REGISTER = "REGISTER" ACTION_NEW_RECORD = "NEW RECORD" )
Variables ¶
This section is empty.
Functions ¶
func FetchOrder ¶
func HashPassword ¶
Types ¶
type DbErr ¶
type DbErr struct { HttpErr echo.HTTPError Err error }
func DeleteById ¶
func FetchAllOrders ¶
func GetActivitiesByUserId ¶
func GetAllPreload ¶
func SeenActivities ¶
func UpdateById ¶
type Order ¶
type Order struct { ID uint `gorm:"primaryKey" json:"id"` User User `json:"-"` UserID uint `gorm:"not null" json:"user_id"` Status string `gorm:"default:IN-PROGRESS" json:"status"` Products []Product `gorm:"many2many:order_products" json:"products,omitempty"` }
func (Order) GetOwnerID ¶
type Product ¶
type Product struct { ID uint `gorm:"primaryKey" json:"id,omitempty"` OrderID uint `json:"order_id,omitempty"` Title string `gorm:"not null" json:"title,omitempty"` Description string `gorm:"not null" json:"description,omitempty"` Price float64 `gorm:"not null" json:"price,omitempty"` Orders []Order `gorm:"many2many:order_products" json:"orders,omitempty"` }
type Refund ¶
type Refund struct { ID uint `gorm:"primaryKey" json:"id,omitempty"` OrderID uint `gorm:"not null; unique" json:"order_id,omitempty"` Status string `gorm:"default:IN-PROGRESS" json:"status,omitempty"` Order Order `json:"order,omitempty"` }
func (Refund) GetOwnerID ¶
type User ¶
type User struct { ID uint `gorm:"primaryKey" json:"id"` Username string `gorm:"not null; unique" json:"username"` Password string `gorm:"not null" json:"password,omitempty"` }
func GetAdminConf ¶
func GetAdminConf() User
func (User) GetOwnerID ¶
Click to show internal directories.
Click to hide internal directories.