Struct pgrx_sql_entity_graph::PostgresHash
source · pub struct PostgresHash {
pub name: Ident,
pub to_sql_config: ToSqlConfig,
}
Expand description
A parsed #[derive(PostgresHash)]
item.
It should be used with syn::parse::Parse
functions.
Using quote::ToTokens
will output the declaration for a pgrx::datum::pgrx_sql_entity_graph::InventoryPostgresHash
.
On structs:
use syn::{Macro, parse::Parse, parse_quote, parse};
use quote::{quote, ToTokens};
use pgrx_sql_entity_graph::PostgresHash;
use pgrx_sql_entity_graph::CodeEnrichment;
let parsed: CodeEnrichment<PostgresHash> = parse_quote! {
#[derive(PostgresHash)]
struct Example<'a> {
demo: &'a str,
}
};
let sql_graph_entity_tokens = parsed.to_token_stream();
On enums:
use syn::{Macro, parse::Parse, parse_quote, parse};
use quote::{quote, ToTokens};
use pgrx_sql_entity_graph::PostgresHash;
use pgrx_sql_entity_graph::CodeEnrichment;
let parsed: CodeEnrichment<PostgresHash> = parse_quote! {
#[derive(PostgresHash)]
enum Demo {
Example,
}
};
let sql_graph_entity_tokens = parsed.to_token_stream();
Fields§
§name: Ident
§to_sql_config: ToSqlConfig
Implementations§
source§impl PostgresHash
impl PostgresHash
pub fn new( name: Ident, to_sql_config: ToSqlConfig ) -> Result<CodeEnrichment<Self>, Error>
pub fn from_derive_input( derive_input: DeriveInput ) -> Result<CodeEnrichment<Self>, Error>
Trait Implementations§
source§impl Clone for PostgresHash
impl Clone for PostgresHash
source§fn clone(&self) -> PostgresHash
fn clone(&self) -> PostgresHash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more