From 9c042f80be13c29bd4e8494bef2ae2511fe087c0 Mon Sep 17 00:00:00 2001 From: Kasper Marstal Date: Tue, 20 Feb 2024 13:43:38 -0800 Subject: [PATCH] Fix inconsistent naming of return_*/call_* functions (#23) --- plprql/src/call.rs | 6 +++--- plprql/src/plprql.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) 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)