models

package
v0.0.0-...-5be1069 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL