Documentation
¶
Index ¶
- Constants
- func CreateOrder(userId uint, description string) (id uint, err error)
- func CreateRefund(orderId uint) (id uint, err error)
- func DeleteOrder(id uint) int64
- func DeleteRefund(id uint) int64
- func InitDB() (err error)
- func LoginUser(username, password, email string) (uint, error)
- func Migrate() error
- func RegisterUser(username, password, email string) error
- func UpdateOrder(id uint, description, status string) int64
- func UpdateRefund(id uint, status string) int64
- func UpdateUser(id uint, username, password, email string) int64
- type Order
- type Refund
- type User
Constants ¶
View Source
const ( ORDER_STATUS_PROCESSING = "processing" ORDER_STATUS_COMPLETED = "completed" ORDER_STATUS_CANCELED = "canceled" )
View Source
const ( REFUND_STATUS_APPENDING = "appending" REFUND_STATUS_APPROVED = "approved" REFUND_STATUS_CANCELED = "canceled" REFUND_ERROR_BADORDER = "Order is not completed" )
Variables ¶
This section is empty.
Functions ¶
func CreateRefund ¶
func DeleteOrder ¶
func DeleteRefund ¶
func RegisterUser ¶
func UpdateOrder ¶
func UpdateRefund ¶
func UpdateUser ¶
Types ¶
type Order ¶
type Order struct { ID uint `gorm:"primaryKey" json:"id"` UserID uint `json:"user_id"` Status string `gorm:"not null;default:processing" json:"status"` Description string `gorm:"not null" json:"description"` User User `json:"-"` }
func GetAllOrders ¶
func GetOrderById ¶
type Refund ¶
type Refund struct { ID uint `gorm:"primaryKey" json:"id"` OrderID uint `gorm:"not null;unique" json:"order_id"` Status string `gorm:"not null;default:appending" json:"status"` Order Order `json:"-"` }
func GetAllRefunds ¶
func GetRefundById ¶
type User ¶
type User struct { ID uint `gorm:"primaryKey" json:"id"` Password string `gorm:"not null" json:"pass"` Username string `gorm:"unique;not null" json:"user"` Email string `gorm:"unique;not null" json:"email"` }
func GetAllUsers ¶
func GetUserById ¶
Click to show internal directories.
Click to hide internal directories.