working commit
This commit is contained in:
@@ -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{}
|
||||
|
||||
Reference in New Issue
Block a user