pg-schema-cache-resolute 0.2.0

PostgreSQL schema cache built on the resolute database client, with LISTEN/NOTIFY-driven reload.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mod error;
mod introspection;
mod listener;

pub use error::SchemaCacheError;
pub use listener::start_schema_listener;
pub use pg_schema_cache_types::*;

use resolute::Executor;

/// Introspects a PostgreSQL database and builds a [`SchemaCache`] containing
/// all tables, columns, relationships, and functions in the given schemas.
pub async fn build_schema_cache(
    db: &impl Executor,
    schemas: &[String],
) -> Result<SchemaCache, SchemaCacheError> {
    introspection::build(db, schemas).await
}