[][src]Macro pgx::name

macro_rules! name {
    ($name:tt, $ty:ty) => { ... };
}

A macro for providing SQL names for the returned fields for functions that return a Rust tuple, especially those that return a std::iter::Iterator<Item=(f1, f2, f3)>

Examples

This example will create a SQL function like so:

CREATE OR REPLACE FUNCTION get_a_set() RETURNS TABLE (id integer, title text) ...;
use pgx::*;
#[pg_extern]
fn get_a_set() -> impl std::iter::Iterator<Item=(name!(id, i32), name!(title, &'static str))> {
    vec![1, 2, 3].into_iter().zip(vec!["A", "B", "C"].into_iter())
}