use-pg-column 0.1.0

PostgreSQL column metadata primitives for RustUse
Documentation
  • Coverage
  • 89.47%
    34 out of 38 items documented1 out of 28 items with examples
  • Size
  • Source code size: 14.63 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 876.74 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-postgres
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-pg-column

PostgreSQL column metadata primitives for RustUse.

This crate provides column names, column type metadata, default-expression labels, nullability, generated-column labels, and identity labels. Defaults are stored as labels and are not parsed or executed.

Example

use use_pg_column::{PgColumn, PgColumnDefault, PgColumnName, PgIdentityKind, PgNullability};
use use_pg_type::PgBuiltInType;

let column = PgColumn::with_built_in_type(PgColumnName::new("id")?, PgBuiltInType::BigInt)
    .with_nullability(PgNullability::NotNull)
    .with_identity(PgIdentityKind::Always)
    .with_default(PgColumnDefault::new("nextval('users_id_seq')")?);

assert_eq!(column.name().as_str(), "id");
assert_eq!(column.type_name().as_str(), "bigint");
assert_eq!(column.nullability(), PgNullability::NotNull);
# Ok::<(), use_pg_column::PgColumnError>(())