Skip to content

Commit

Permalink
Fix inconsistent naming of return_*/call_* functions (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspermarstal authored Feb 20, 2024
1 parent 55634d4 commit 9c042f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions plprql/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TableIterator<'static, Row>> + '_ {
pub(crate) fn call_table_iterator(function: &Function) -> impl FnOnce() -> Option<TableIterator<'static, Row>> + '_ {
|| -> Option<TableIterator<'static, Row>> {
let sql = prql_to_sql(&function.body()).report();
let arguments = function.arguments().report();
Expand Down Expand Up @@ -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<SetOfIterator<'static, Option<AnyDatum>>> + '_ {
|| -> Option<SetOfIterator<'static, Option<AnyDatum>>> {
Expand Down Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions plprql/src/plprql.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9c042f8

Please sign in to comment.