Documentation ¶ Index ¶ func DoOperation(Type string, a int, b int) (string, error) type Operation func (u *Operation) BeforeSave(tx *gorm.DB) (err error) type Record type User func (u *User) BeforeSave(tx *gorm.DB) (err error) Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func DoOperation ¶ func DoOperation(Type string, a int, b int) (string, error) Types ¶ type Operation ¶ type Operation struct { gorm.Model Type string `gorm:"uniqueIndex"` Cost int64 } func (*Operation) BeforeSave ¶ func (u *Operation) BeforeSave(tx *gorm.DB) (err error) type Record ¶ type Record struct { gorm.Model OperationID int Operation Operation UserID int `gorm:"index:idx_balance"` User User Amount int64 UserBalance int64 `gorm:"index:idx_balance,priority:1,sort:desc"` OperationResponse string Date time.Time } type User ¶ type User struct { gorm.Model Username string `gorm:"uniqueIndex"` Password string Status string } func (*User) BeforeSave ¶ func (u *User) BeforeSave(tx *gorm.DB) (err error) Source Files ¶ View all Source files operationModel.go recordModel.go userModel.go Click to show internal directories. Click to hide internal directories.