Skip to content

Commit

Permalink
feat(pg): support non-scalar range values (#591)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjie Gillam <[email protected]>
  • Loading branch information
singingwolfboy and benjie committed Jan 7, 2020
1 parent 86b9675 commit d1f51e0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/graphile-build-pg/src/plugins/PgTypesPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,17 @@ export default (function PgTypesPlugin(
subtype.id,
typeModifier
);
const gqlRangeInputSubType = getGqlInputTypeByTypeIdAndModifier(
subtype.id,
typeModifier
);

if (!gqlRangeSubType || !isNamedType(gqlRangeSubType)) {
throw new Error("Range of unsupported type");
}
if (!gqlRangeInputSubType || !isNamedType(gqlRangeInputSubType)) {
throw new Error("Range of unsupported input type");
}
const existingRange = getTypeByName(
inflection.rangeType(gqlRangeSubType.name)
);
Expand Down Expand Up @@ -874,7 +881,7 @@ export default (function PgTypesPlugin(
fields: {
value: {
description: "The value at one end of our range.",
type: new GraphQLNonNull(gqlRangeSubType),
type: new GraphQLNonNull(gqlRangeInputSubType),
},

inclusive: {
Expand Down

0 comments on commit d1f51e0

Please sign in to comment.