pub trait FunctionMetadata<Inputs, Output> {
// Required method
fn entity(&self) -> FunctionMetadataEntity;
// Provided method
fn path(&self) -> &'static str { ... }
}
Expand description
Provide SQL generation related information on functions
use pgrx_sql_entity_graph::metadata::{FunctionMetadata, Returns, SqlMapping};
fn floof(i: i32) -> String { todo!() }
type FunctionPointer = fn(i32) -> String;
let marker: FunctionPointer = floof;
let metadata = pgrx_sql_entity_graph::metadata::FunctionMetadata::entity(&marker);
assert_eq!(
metadata.retval.unwrap().return_sql,
Ok(Returns::One(SqlMapping::As("TEXT".to_string()))),
);