feat(wfe-postgres): add PostgreSQL persistence provider
PostgresPersistenceProvider using sqlx with wfc schema. JSONB for complex fields, TIMESTAMPTZ for dates. Transactions for atomicity. Proper error propagation on deserialization (no unwrap_or_default). Status conversion returns Result for unknown values.
This commit is contained in:
16
wfe-postgres/tests/persistence.rs
Normal file
16
wfe-postgres/tests/persistence.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use wfe_core::persistence_suite;
|
||||
use wfe_core::traits::PersistenceProvider;
|
||||
|
||||
async fn make_provider() -> wfe_postgres::PostgresPersistenceProvider {
|
||||
let database_url = "postgres://wfe:wfe@localhost:5433/wfe_test";
|
||||
|
||||
let provider = wfe_postgres::PostgresPersistenceProvider::new(database_url)
|
||||
.await
|
||||
.expect("Failed to connect to PostgreSQL. Is the database running?");
|
||||
|
||||
provider.ensure_store_exists().await.unwrap();
|
||||
provider.truncate_all().await.unwrap();
|
||||
provider
|
||||
}
|
||||
|
||||
persistence_suite!(make_provider);
|
||||
Reference in New Issue
Block a user