Extra configuration options can be set on SQL entities using comment directives.
Comment Directives
Comment directives are snippets of configuration associated with SQL entities that alter how those entities behave.
The format of a comment directive is
1
@graphql(<JSON>)
Inflection
Inflection describes how SQL entities' names are transformed into GraphQL type and field names. By default, inflection is disabled and SQL names are literally interpolated such that
1234
createtable"BlogPost"(idintprimarykey,...);
results in GraphQL type names like
1234
BlogPost
BlogPostEdge
BlogPostConnection
...
Since snake case is a common casing structure for SQL types, pg_graphql support basic inflection from snake_case to PascalCase for type names, and snake_case to camelCase for field names to match Javascript conventions.
The inflection directive can be applied at the schema level with:
For more fine grained adjustments to reflected names, see renaming.
totalCount
totalCount is an opt-in field that extends a table's Connection type. It provides a count of the rows that match the query's filters, and ignores pagination arguments.
1234567
typeBlogPostConnection{
edges: [BlogPostEdge!]!
pageInfo: PageInfo!"""The total number of records matching the `filter` criteria"""
totalCount: Int!# this field}
to enable totalCount for a table, use the directive