diff --git a/plprql/src/call.rs b/plprql/src/call.rs index 1a3bbf8..a51899c 100644 --- a/plprql/src/call.rs +++ b/plprql/src/call.rs @@ -6,7 +6,7 @@ use pgrx::pg_return_null; use pgrx::pg_sys::panic::ErrorReportable; use pgrx::prelude::*; -pub(crate) fn return_table_iterator(function: &Function) -> impl FnOnce() -> Option> + '_ { +pub(crate) fn call_table_iterator(function: &Function) -> impl FnOnce() -> Option> + '_ { || -> Option> { let sql = prql_to_sql(&function.body()).report(); let arguments = function.arguments().report(); @@ -38,7 +38,7 @@ pub(crate) fn return_table_iterator(function: &Function) -> impl FnOnce() -> Opt } } -pub(crate) fn return_setof_iterator( +pub(crate) fn call_setof_iterator( function: &Function, ) -> impl FnOnce() -> Option>> + '_ { || -> Option>> { @@ -68,7 +68,7 @@ pub(crate) fn return_setof_iterator( } } -pub(crate) fn return_scalar(function: &Function) -> pg_sys::Datum { +pub(crate) fn call_scalar(function: &Function) -> pg_sys::Datum { let sql = prql_to_sql(&function.body()).report(); let arguments = function.arguments().report(); diff --git a/plprql/src/plprql.rs b/plprql/src/plprql.rs index fa95c57..e57008e 100644 --- a/plprql/src/plprql.rs +++ b/plprql/src/plprql.rs @@ -1,4 +1,4 @@ -use crate::call::{return_scalar, return_setof_iterator, return_table_iterator}; +use crate::call::{call_scalar, call_setof_iterator, call_table_iterator}; use crate::err::PlprqlResult; use crate::fun::{Function, Return}; use pgrx::prelude::*; @@ -60,9 +60,9 @@ unsafe fn plprql_call_handler(function_call_info: pg_sys::FunctionCallInfo) -> P let function = Function::from_call_info(function_call_info)?; let datum = match function.return_mode() { - Return::Table => TableIterator::srf_next(function.call_info, return_table_iterator(&function)), - Return::SetOf => SetOfIterator::srf_next(function.call_info, return_setof_iterator(&function)), - Return::Scalar => return_scalar(&function), + Return::Table => TableIterator::srf_next(function.call_info, call_table_iterator(&function)), + Return::SetOf => SetOfIterator::srf_next(function.call_info, call_setof_iterator(&function)), + Return::Scalar => call_scalar(&function), }; Ok(datum)