working commit

This commit is contained in:
2026-02-14 18:45:11 +02:00
parent 8d46c6a677
commit 53ed35dc08
16 changed files with 144 additions and 120 deletions
+17
View File
@@ -76,6 +76,23 @@ func (db *Database) GetGrantByID(ctx context.Context, id string) (bool, *descr.G
return true, res, err
}
func (db *Database) GetGrantByAccoundIDRight(ctx context.Context, accountID, right string) (bool, *descr.Grant, error) {
var err error
res := &descr.Grant{}
request := `SELECT * FROM grants WHERE account_id = $1 AND right = $2 LIMIT 1`
dbRes := make([]descr.Grant, 0)
err = db.db.Select(&dbRes, request, accountID, right)
if err != nil {
return false, res, err
}
if len(dbRes) == 0 {
return false, res, err
}
res = &dbRes[0]
return true, res, err
}
func (db *Database) GetGrantByAccoundIDRightPattern(ctx context.Context, accountID, right, pattern string) (bool, *descr.Grant, error) {
var err error
res := &descr.Grant{}