Struct pgrx_sql_entity_graph::PgrxSql
source · pub struct PgrxSql {Show 17 fields
pub control: ControlFile,
pub graph: StableGraph<SqlGraphEntity, SqlGraphRelationship>,
pub graph_root: NodeIndex,
pub graph_bootstrap: Option<NodeIndex>,
pub graph_finalize: Option<NodeIndex>,
pub schemas: HashMap<SchemaEntity, NodeIndex>,
pub extension_sqls: HashMap<ExtensionSqlEntity, NodeIndex>,
pub externs: HashMap<PgExternEntity, NodeIndex>,
pub types: HashMap<PostgresTypeEntity, NodeIndex>,
pub builtin_types: HashMap<String, NodeIndex>,
pub enums: HashMap<PostgresEnumEntity, NodeIndex>,
pub ords: HashMap<PostgresOrdEntity, NodeIndex>,
pub hashes: HashMap<PostgresHashEntity, NodeIndex>,
pub aggregates: HashMap<PgAggregateEntity, NodeIndex>,
pub triggers: HashMap<PgTriggerEntity, NodeIndex>,
pub extension_name: String,
pub versioned_so: bool,
}
Expand description
A generator for SQL.
Consumes a base mapping of types (typically pgrx::DEFAULT_TYPEID_SQL_MAPPING
), a
ControlFile
, and collections of each SQL entity.
During construction, a Directed Acyclic Graph is formed out the dependencies. For example,
an item detect_dog(x: &[u8]) -> animals::Dog
would have have a relationship with
animals::Dog
.
Typically, PgrxSql
types are constructed in a pgrx::pg_binary_magic!()
call in a binary
out of entities collected during a pgrx::pg_module_magic!()
call in a library.
Fields§
§control: ControlFile
§graph: StableGraph<SqlGraphEntity, SqlGraphRelationship>
§graph_root: NodeIndex
§graph_bootstrap: Option<NodeIndex>
§graph_finalize: Option<NodeIndex>
§schemas: HashMap<SchemaEntity, NodeIndex>
§extension_sqls: HashMap<ExtensionSqlEntity, NodeIndex>
§externs: HashMap<PgExternEntity, NodeIndex>
§types: HashMap<PostgresTypeEntity, NodeIndex>
§builtin_types: HashMap<String, NodeIndex>
§enums: HashMap<PostgresEnumEntity, NodeIndex>
§ords: HashMap<PostgresOrdEntity, NodeIndex>
§hashes: HashMap<PostgresHashEntity, NodeIndex>
§aggregates: HashMap<PgAggregateEntity, NodeIndex>
§triggers: HashMap<PgTriggerEntity, NodeIndex>
§extension_name: String
§versioned_so: bool
Implementations§
source§impl PgrxSql
impl PgrxSql
pub fn build( entities: impl Iterator<Item = SqlGraphEntity>, extension_name: String, versioned_so: bool ) -> Result<Self>
pub fn to_file(&self, file: impl AsRef<Path> + Debug) -> Result<()>
pub fn write(&self, out: &mut impl Write) -> Result<()>
pub fn to_dot(&self, file: impl AsRef<Path> + Debug) -> Result<()>
pub fn schema_alias_of(&self, item_index: &NodeIndex) -> Option<String>
pub fn schema_prefix_for(&self, target: &NodeIndex) -> String
pub fn to_sql(&self) -> Result<String>
pub fn has_sql_declared_entity( &self, identifier: &SqlDeclared ) -> Option<&SqlDeclaredEntity>
pub fn source_only_to_sql_type(&self, _ty_source: &str) -> Option<String>
pub fn get_module_pathname(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for PgrxSql
impl Send for PgrxSql
impl Sync for PgrxSql
impl Unpin for PgrxSql
impl UnwindSafe for PgrxSql
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more