Files
YaeMikoBot/database/works.go
2025-08-27 23:26:36 +03:00

25 lines
460 B
Go

package database
import "github.com/shopspring/decimal"
type Work struct {
ID int
Name string
RequiredLevel int
MoneyIncome decimal.Decimal
MinExp int
MaxExp int
}
func GetWorkById(id int) (*Work, error) {
work := new(Work)
tx := Database.First(work, id)
return work, tx.Error
}
func GetAllWorks() ([]*Work, error) {
works := make([]*Work, 0)
tx := Database.Order("id").Find(&works)
return works, tx.Error
}