Add PgTypeInfo::with_oid

This commit is contained in:
Jonas Platte 2020-01-18 14:04:17 +01:00
parent 9141bd7561
commit f93beb460a
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -24,6 +24,14 @@ impl PgTypeInfo {
pub(crate) fn new(id: TypeId) -> Self {
Self { id }
}
/// Create a `PgTypeInfo` from a type's object identifier.
///
/// The object identifier of a type can be queried with
/// `SELECT oid FROM pg_type WHERE typname = <name>;`
pub fn with_oid(oid: u32) -> Self {
Self { id: TypeId(oid) }
}
}
impl Display for PgTypeInfo {