Skip to content

Commit

Permalink
feat(plugins): enable plugins to prevent using asterisk (#436)
Browse files Browse the repository at this point in the history
This is important for plugins that need to get access to certain special
table properties, such as `ctid`.
  • Loading branch information
benjie committed Apr 12, 2019
1 parent d4d53ce commit 49b9da4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/graphile-build-pg/src/queryFromResolveDataFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default (queryBuilderOptions: QueryBuilderOptions = {}) => (
from: SQL,
fromAlias: ?SQL,
resolveData: DataForType,
options: {
inOptions: {
withPagination?: boolean,
withPaginationAsFields?: boolean,
asJson?: boolean,
Expand All @@ -36,11 +36,21 @@ export default (queryBuilderOptions: QueryBuilderOptions = {}) => (
pgQuery,
pgAggregateQuery,
pgCursorPrefix: reallyRawCursorPrefix,
pgDontUseAsterisk,
calculateHasNextPage,
calculateHasPreviousPage,
usesCursor: explicitlyUsesCursor,
} = resolveData;

const preventAsterisk = pgDontUseAsterisk
? pgDontUseAsterisk.length > 0
: false;
const options = {
...inOptions,
// Allow pgDontUseAsterisk to override useAsterisk
useAsterisk: inOptions.useAsterisk && !preventAsterisk,
};

const usesCursor: boolean =
(explicitlyUsesCursor && explicitlyUsesCursor.length > 0) ||
(calculateHasNextPage && calculateHasNextPage.length > 0) ||
Expand Down

0 comments on commit 49b9da4

Please sign in to comment.