laniakea v1.0.0 rc1
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type Waifu struct {
|
||||
ID int
|
||||
ID int64
|
||||
OwnerID sql.NullInt64 `db:"owner_id"`
|
||||
Name string
|
||||
Rarity int
|
||||
@@ -51,7 +51,7 @@ func (rep *WaifuRepository) GetAll() ([]*Waifu, error) {
|
||||
return waifus, err
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetByUserId(userId int) ([]*Waifu, error) {
|
||||
func (rep *WaifuRepository) GetByUserId(userId int64) ([]*Waifu, error) {
|
||||
waifus, err := sqlx.List[*Waifu](rep.db, "SELECT waifus.* FROM waifus WHERE owner_id=$1;", userId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -69,7 +69,7 @@ func (rep *WaifuRepository) GetByUserId(userId int) ([]*Waifu, error) {
|
||||
return waifus, nil
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetCountByUserId(userId int) (int64, error) {
|
||||
func (rep *WaifuRepository) GetCountByUserId(userId int64) (int64, error) {
|
||||
var count int64 = 0
|
||||
err := rep.db.QueryRow("SELECT COUNT(*) FROM waifus WHERE owner_id=$1;", userId).Scan(&count)
|
||||
return count, err
|
||||
@@ -91,7 +91,7 @@ func (rep *WaifuRepository) GetFreeByRarity(rarity int) ([]Waifu, error) {
|
||||
return waifus, err
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetById(id int) (*Waifu, error) {
|
||||
func (rep *WaifuRepository) GetById(id int64) (*Waifu, error) {
|
||||
waifu := new(Waifu)
|
||||
err := rep.db.Get(waifu, "SELECT * FROM waifus WHERE id=$1;", id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user