pub struct ToSqlConfigEntity<'a> {
pub enabled: bool,
pub content: Option<&'a str>,
}Expand description
Represents configuration options for tuning the SQL generator.
When an item that can be rendered to SQL has these options at hand, they should be respected. If an item does not have them, then it is not expected that the SQL generation for those items can be modified.
The default configuration has enabled set to true, which indicates that the default SQL
generation behavior will be used.
When enabled is false, no SQL is generated for the item being configured.
Fields§
§enabled: bool§content: Option<&'a str>Implementations§
Source§impl ToSqlConfigEntity<'_>
impl ToSqlConfigEntity<'_>
Sourcepub fn to_sql(
&self,
entity: &SqlGraphEntity<'_>,
context: &PgrxSql<'_>,
) -> Option<Result<String>>
pub fn to_sql( &self, entity: &SqlGraphEntity<'_>, context: &PgrxSql<'_>, ) -> Option<Result<String>>
Given a SqlGraphEntity, this function converts it to SQL based on the current configuration.
If the config overrides the default behavior (i.e. using the ToSql trait), then Some(eyre::Result)
is returned. If the config does not override the default behavior, then None is returned. This can
be used to dispatch SQL generation in a single line, e.g.:
config.to_sql(entity, context).unwrap_or_else(|| entity.to_sql(context))?Trait Implementations§
Source§impl<'a> Clone for ToSqlConfigEntity<'a>
impl<'a> Clone for ToSqlConfigEntity<'a>
Source§fn clone(&self) -> ToSqlConfigEntity<'a>
fn clone(&self) -> ToSqlConfigEntity<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToSqlConfigEntity<'_>
impl Debug for ToSqlConfigEntity<'_>
Source§impl<'a> Default for ToSqlConfigEntity<'a>
impl<'a> Default for ToSqlConfigEntity<'a>
Source§fn default() -> ToSqlConfigEntity<'a>
fn default() -> ToSqlConfigEntity<'a>
Source§impl Hash for ToSqlConfigEntity<'_>
impl Hash for ToSqlConfigEntity<'_>
Source§impl Ord for ToSqlConfigEntity<'_>
impl Ord for ToSqlConfigEntity<'_>
Source§impl PartialEq for ToSqlConfigEntity<'_>
impl PartialEq for ToSqlConfigEntity<'_>
Source§impl PartialOrd for ToSqlConfigEntity<'_>
impl PartialOrd for ToSqlConfigEntity<'_>
impl Eq for ToSqlConfigEntity<'_>
Auto Trait Implementations§
impl<'a> Freeze for ToSqlConfigEntity<'a>
impl<'a> RefUnwindSafe for ToSqlConfigEntity<'a>
impl<'a> Send for ToSqlConfigEntity<'a>
impl<'a> Sync for ToSqlConfigEntity<'a>
impl<'a> Unpin for ToSqlConfigEntity<'a>
impl<'a> UnsafeUnpin for ToSqlConfigEntity<'a>
impl<'a> UnwindSafe for ToSqlConfigEntity<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.