pgrx_sql_entity_graph

Struct PgrxSql

Source
pub struct PgrxSql {
Show 17 fields pub control: ControlFile, pub graph: StableGraph<SqlGraphEntity, SqlGraphRequires>, 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, SqlGraphRequires>§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

Source

pub fn build( entities: impl Iterator<Item = SqlGraphEntity>, extension_name: String, versioned_so: bool, ) -> Result<Self>

Source

pub fn to_file(&self, file: impl AsRef<Path> + Debug) -> Result<()>

Source

pub fn write(&self, out: &mut impl Write) -> Result<()>

Source

pub fn to_dot(&self, file: impl AsRef<Path> + Debug) -> Result<()>

Source

pub fn schema_alias_of(&self, item_index: &NodeIndex) -> Option<String>

Source

pub fn schema_prefix_for(&self, target: &NodeIndex) -> String

Source

pub fn to_sql(&self) -> Result<String>

Source

pub fn has_sql_declared_entity( &self, identifier: &SqlDeclared, ) -> Option<&SqlDeclaredEntity>

Source

pub fn get_module_pathname(&self) -> String

Trait Implementations§

Source§

impl Clone for PgrxSql

Source§

fn clone(&self) -> PgrxSql

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PgrxSql

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.