Files
YaeMikoBot/database/psql/works.go
2026-01-14 14:29:03 +03:00

29 lines
663 B
Go

package psql
import (
"kurumibot/database"
"github.com/shopspring/decimal"
)
type Work struct {
ID int
Name string
RequiredLevel int `db:"required_level"`
MoneyIncome decimal.Decimal `db:"money_income"`
MinExp int `db:"min_exp"`
MaxExp int `db:"max_exp"`
}
func GetWorkById(id int) (Work, error) {
work := Work{}
err := database.PostgresDatabase.Get(&work, "SELECT * FROM works WHERE id = $1;", id)
return work, err
}
func GetAllWorks() ([]Work, error) {
works := make([]Work, 0)
err := database.PostgresDatabase.Select(&works, "SELECT * FROM works;")
return works, err
}