Trait diesel::pg::PgMetadataLookup

source ·
pub trait PgMetadataLookup {
    // Required method
    fn lookup_type(
        &mut self,
        type_name: &str,
        schema: Option<&str>,
    ) -> PgTypeMetadata;

    // Provided method
    fn as_any<'a>(&mut self) -> &mut (dyn Any + 'a)
       where Self: 'a { ... }
}
Expand description

Determines the OID of types at runtime

Custom implementations of Connection<Backend = Pg> should not implement this trait directly. Instead GetPgMetadataCache should be implemented, afterwards the generic implementation will provide the necessary functions to perform the type lookup.

Required Methods§

source

fn lookup_type( &mut self, type_name: &str, schema: Option<&str>, ) -> PgTypeMetadata

Determine the type metadata for the given type_name

This function should only be used for user defined types, or types which come from an extension. This function may perform a SQL query to look up the type. For built-in types, a static OID should be preferred.

Provided Methods§

source

fn as_any<'a>(&mut self) -> &mut (dyn Any + 'a)
where Self: 'a,

Convert this lookup instance to a std::any::Any pointer

Implementing this method is required to support #[derive(MultiConnection)]

Implementors§