use-pg-type 0.1.0

PostgreSQL type primitives for RustUse
Documentation
  • Coverage
  • 27.59%
    16 out of 58 items documented1 out of 16 items with examples
  • Size
  • Source code size: 14.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 736.33 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s 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-type

PostgreSQL type primitives for RustUse.

This crate provides type-name labels, broad type categories, common built-in type labels, array-like labels, and an optional primitive OID wrapper. It does not bind built-in labels to live PostgreSQL catalog OIDs.

Example

use use_pg_type::{PgBuiltInType, PgTypeCategory, PgTypeName, PgTypeOid};

let ty: PgBuiltInType = "timestamptz".parse()?;
let text = PgTypeName::built_in(PgBuiltInType::Text);
let text_array = PgTypeName::array_of(&text);
let oid = PgTypeOid::new(23)?;

assert_eq!(ty.to_string(), "timestamp with time zone");
assert_eq!(PgBuiltInType::Jsonb.category(), PgTypeCategory::Json);
assert_eq!(text_array.to_string(), "text[]");
assert_eq!(oid.get(), 23);
# Ok::<(), use_pg_type::PgTypeError>(())