some fixes and new features
This commit is contained in:
@@ -62,6 +62,12 @@ func (rep *WaifuRepository) GetByUserId(userId int) ([]*Waifu, error) {
|
||||
return waifus, nil
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetCountByUserId(userId int) (int64, error) {
|
||||
var count int64 = 0
|
||||
err := rep.db.QueryRow("SELECT COUNT(*) FROM waifus WHERE owner_id=$1;", userId).Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
func (rep *WaifuRepository) GetFree() ([]*Waifu, error) {
|
||||
waifus, err := sqlx.List[*Waifu](rep.db, "SELECT * FROM waifus WHERE owner_id IS NULL;")
|
||||
return waifus, err
|
||||
|
||||
Reference in New Issue
Block a user