use-pg-table 0.1.0

PostgreSQL table object primitives for RustUse
Documentation

use-pg-table

PostgreSQL table object primitives for RustUse.

This crate provides table names, schema-qualified table references, table-kind labels, persistence labels, and table metadata. It does not introspect a live database.

Example

use use_pg_schema::PgSchemaName;
use use_pg_table::{PgTable, PgTableKind, PgTableName, PgTablePersistence, PgTableRef};

let table_ref = PgTableRef::qualified(PgSchemaName::public(), PgTableName::new("users")?);
let table = PgTable::new(table_ref.clone())
    .with_kind(PgTableKind::Ordinary)
    .with_persistence(PgTablePersistence::Permanent);

assert_eq!(table_ref.to_string(), "public.users");
assert_eq!(table.kind(), PgTableKind::Ordinary);
# Ok::<(), Box<dyn std::error::Error>>(())