use super::PostgresSchemaExt;
#[derive(Debug, Clone)]
pub struct DatabaseExtension {
pub name: String,
pub schema: String,
pub version: String,
pub relocatable: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ExtensionId(pub(crate) u32);
#[derive(Clone, Copy)]
pub struct ExtensionWalker<'a> {
pub id: ExtensionId,
pub(super) schema_ext: &'a PostgresSchemaExt,
}
impl<'a> ExtensionWalker<'a> {
pub fn name(self) -> &'a str {
&self.extension().name
}
pub fn schema(self) -> &'a str {
&self.extension().schema
}
pub fn version(self) -> &'a str {
&self.extension().version
}
pub fn relocatable(self) -> bool {
self.extension().relocatable
}
fn extension(self) -> &'a DatabaseExtension {
&self.schema_ext.extensions[self.id.0 as usize]
}
}