friends/database/wiiu/unset_user_blocked.go
Daniel López Guimaraes 8d8a05a7e2
Add missing error handling
Now database getters do error handling aswell, and in case of any error,
the NEX or GRPC method throws a proper error about it.

There are still some doubts on how to handle errors when a list of data
is processed, so for now skip that element on the list and continue.

Also add some constant errors to do better error handling.
2023-08-13 23:19:34 +01:00

22 lines
460 B
Go

package database_wiiu
import (
"github.com/PretendoNetwork/friends/database"
)
// Remove a block from a user
func UnsetUserBlocked(user1_pid uint32, user2_pid uint32) error {
result, err := database.Postgres.Exec(`
DELETE FROM wiiu.blocks WHERE blocker_pid=$1 AND blocked_pid=$2`, user1_pid, user2_pid)
if err != nil {
return err
}
rowsAffected, _ := result.RowsAffected()
if rowsAffected == 0 {
return database.ErrPIDNotFound
}
return nil
}