feat(state): audit access resets, org and EDA writes
This commit is contained in:
1 parent
0cccef6bb7
commit
99b1f8a2d9
12 files changed
+758
-167
No files matched your search
@@ -150,3 +150,20 @@ func (q *Queries) InsertResourceAudit(ctx context.Context, arg InsertResourceAud
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const lockAuditRecord = `-- name: LockAuditRecord :exec
|
||||
SELECT pg_advisory_xact_lock(hashtextextended($1::text || ':' || $2::text, 0))
|
||||
`
|
||||
|
||||
type LockAuditRecordParams struct {
|
||||
TableName string
|
||||
RecordKey string
|
||||
}
|
||||
|
||||
// Serialises a read-modify-write on one audited record so the old side the
|
||||
// audit row reports cannot change between the read and the write. Row locks
|
||||
// cannot hold a key that does not exist yet; this can.
|
||||
func (q *Queries) LockAuditRecord(ctx context.Context, arg LockAuditRecordParams) error {
|
||||
_, err := q.db.Exec(ctx, lockAuditRecord, arg.TableName, arg.RecordKey)
|
||||
return err
|
||||
}
|
||||
Reference in new issue
Block a user