Skip to content

Commit

Permalink
Expose fieldName to filter resolve callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Nov 24, 2024
1 parent 32af157 commit 0283d9d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/PgConnectionArgFilterOperatorsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,11 @@ export interface OperatorSpec {
sqlIdentifier: SQL,
sqlValue: SQL,
$input: InputStep,
$placeholderable: PlaceholderableStep
$placeholderable: PlaceholderableStep,
details: {
// TODO: move $input and $placeholderable here too
fieldName: string;
}
) => SQL;
resolveType?: (type: GraphQLInputType) => GraphQLInputType;
}
Expand Down Expand Up @@ -1265,6 +1269,7 @@ export function makeApplyPlanFromOperatorSpec(
return EXPORTABLE(
(
connectionFilterAllowNullInput,
fieldName,
lambda,
resolve,
resolveInput,
Expand Down Expand Up @@ -1335,11 +1340,14 @@ export function makeApplyPlanFromOperatorSpec(
*/
$where.placeholder($resolvedInput, inputCodec);

const fragment = resolve(sqlIdentifier, sqlValue, $input, $where);
const fragment = resolve(sqlIdentifier, sqlValue, $input, $where, {
fieldName,
});
$where.where(fragment);
},
[
connectionFilterAllowNullInput,
fieldName,
lambda,
resolve,
resolveInput,
Expand Down

0 comments on commit 0283d9d

Please sign in to comment.