Schema

makeExtendSchemaPlugin

Allows us to extend the graphql schema that is generated by Postgraphile

  • It does this by allowing us to define additional Graphql Types and Resolvers and merge them into our schema.
  • To accomplish this, the callback we pass to makeExtendSchemaPlugin should return the typeDefs (schema definition) and the resolvers function

typeDefs

This allows us to specify how our Graphql schema will be extended.

  • ex. Will we be adding a new subscription on it? A new InputType?

build

The build argument to the makeExtendSchemaPlugin contains information and helpers defined by various plugins in the Postgraphile ecosystem

  • most importantly, it includes:
    1. introspection results (build.pgIntrospectionResultsByKind)
    2. inflection functions (build.inflection)
    3. an SQL helper (build.pgSql, an instance of pg-sql2

selectGraphQLResultFromTable

This helper populates data that is returned from our resolver

  • It should not be used to retrieve data for our resolver to process.
    • Instead use context.pgClient directly.

This helper should not be called more than once per resolver (which wouldn't make sense anyway)


Children
  1. Directives
  2. Views