log middleware
This commit is contained in:
28
database/psql/works.go
Normal file
28
database/psql/works.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package psql
|
||||
|
||||
import (
|
||||
"kurumibot/database"
|
||||
|
||||
"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.PostgresDatabase.First(work, id)
|
||||
return work, tx.Error
|
||||
}
|
||||
|
||||
func GetAllWorks() ([]*Work, error) {
|
||||
works := make([]*Work, 0)
|
||||
tx := database.PostgresDatabase.Order("id").Find(&works)
|
||||
return works, tx.Error
|
||||
}
|
||||
Reference in New Issue
Block a user