Skip to content

Commit

Permalink
Merge pull request #72 from jplatte/master
Browse files Browse the repository at this point in the history
Add PgTypeInfo::with_oid
  • Loading branch information
mehcode authored Jan 20, 2020
2 parents 9141bd7 + f93beb4 commit d26040f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sqlx-core/src/postgres/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d26040f

Please sign in to comment.