Expand description
SQLx support for gatekeep query lowering and durable decision audit.
This crate lowers a gatekeep::ResidualPolicy into trusted SQL fragments
that can be appended to a sqlx::QueryBuilder.
It also provides SqlxDecisionAuditRepository, an async
gatekeep::AuditSink implementation for Postgres, SQLite, and MySQL. Run
the matching migration under migrations/{postgres,sqlite,mysql}, construct
the backend repository alias such as PgDecisionAuditRepository, and pass
it to gatekeep_axum::Gatekeeper::with_audit_sink.
Decision audit rows are stored with structured child rows for consulted
facts, obligations, request subjects, and denial reason parameters. Each
recorded decision also writes a gatekeep_audit_outbox row for downstream
export workers.
Structs§
- Decision
Audit Record - Persisted decision audit entry.
- NoGrade
Projection - Projection that rejects grade lowering.
- Ordinal
Projection - Outcome projection backed by
SqlOutcome. - Postgres
Backend - Postgres backend marker.
- Sqlx
Decision Audit Repository - SQLx-backed decision audit repository.
- Sqlx
Fragment - Trusted SQL plus ordered bind values for one
SQLxbackend. - Sqlx
Lowerer SQLxlowerer for gatekeep residual policies.
Enums§
- Sqlx
Audit Error SQLxaudit repository errors.- Sqlx
Driver - Supported
SQLxdatabase driver. - Sqlx
Driver Error - Database driver configuration error.
- Sqlx
Value - Scalar value carried by a lowered SQL fragment.
Traits§
- Gatekeep
Sqlx Backend SQLxbackend supported by gatekeep lowering.- Outcome
Projection - Projection strategy for turning outcomes into SQL fragments.
- PgFact
Predicates - Maps a residual fact to a trusted Postgres predicate over the candidate row.
- SqlOutcome
- Maps a policy outcome to a total-order SQL ordinal.
- Sqlx
Audit Store - SQLx-side decision audit contract.
- Sqlx
Fact Predicates - Maps a residual fact to a trusted predicate over the candidate row.
Functions§
- infer_
enabled_ driver_ from_ url - Infers the
SQLxdriver from a database URL orSQLx-styleSQLitememory URL. - validate_
database_ url_ for_ backend - Validates that a database URL matches a selected backend.
Type Aliases§
- PgDecision
Audit Repository - Postgres-backed decision audit repository.
- PgFragment
- Trusted Postgres SQL plus ordered bind values.
- PgLowerer
- Postgres lowerer for gatekeep residual policies.
- PgValue
- Postgres scalar value carried by a lowered SQL fragment.