graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.GraphQL.Schema.Select

Description

Generate table selection schema both for ordinary Hasura-type and relay-type queries. All schema with "relay" or "connection" in the name is used exclusively by relay.

Synopsis

Documentation

defaultSelectTable Source #

Arguments

:: forall b r m n. (MonadBuildSchema b r m n, BackendTableSelectSchema b) 
=> SourceInfo b 
-> TableInfo b

table info

-> Name

field display name

-> Maybe Description

field description, if any

-> m (Maybe (FieldParser n (SelectExp b))) 

Simple table selection.

The field for the table accepts table selection arguments, and expects a selection of fields

table_name(limit: 10) {
  col1: col1_type
  col2: col2_type
}: [table!]!

selectTableConnection Source #

Arguments

:: forall b r m n. (MonadBuildSchema b r m n, BackendTableSelectSchema b, AggregationPredicatesSchema b) 
=> SourceInfo b 
-> TableInfo b

table info

-> Name

field display name

-> Maybe Description

field description, if any

-> PrimaryKeyColumns b

primary key columns

-> m (Maybe (FieldParser n (ConnectionSelectExp b))) 

Simple table connection selection.

The field for the table accepts table connection selection argument, and expects a selection of connection fields

table_name_connection(first: 1) {
  pageInfo: {
    hasNextPage: Boolean!
    endCursor: String!
  }
  edges: {
    cursor: String!
    node: {
      id: ID!
      col1: col1_type
      col2: col2_type
    }
  }
}: table_nameConnection!

selectTableByPk Source #

Arguments

:: forall b r m n. (MonadBuildSchema b r m n, BackendTableSelectSchema b) 
=> SourceInfo b 
-> TableInfo b

table info

-> Name

field display name

-> Maybe Description

field description, if any

-> m (Maybe (FieldParser n (SelectExp b))) 

Table selection by primary key.

table_name(id: 42) {
  col1: col1_type
  col2: col2_type
}: table

Returns Nothing if there's nothing that can be selected with current permissions or if there are primary keys the user doesn't have select permissions for.

defaultSelectTableAggregate Source #

Arguments

:: forall b r m n. (MonadBuildSchema b r m n, BackendTableSelectSchema b) 
=> SourceInfo b 
-> TableInfo b

table info

-> Name

field display name

-> Maybe Description

field description, if any

-> m (Maybe (FieldParser n (AggSelectExp b))) 

Table aggregation selection

Parser for an aggregation selection of a table. > table_aggregate(limit: 10) { > aggregate: table_aggregate_fields > nodes: [table!]! > } :: table_aggregate!

Returns Nothing if there's nothing that can be selected with current permissions.

defaultTableSelectionSet :: forall b r m n. (AggregationPredicatesSchema b, BackendTableSelectSchema b, Eq (AnnBoolExp b (UnpreparedValue b)), MonadBuildSchema b r m n) => SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Output n (AnnotatedFields b))) Source #

Fields of a table

type table{
  # table columns
  column_1: column1_type
  .
  column_n: columnn_type

  # table relationships
  object_relationship: remote_table
  array_relationship: [remote_table!]!

  # computed fields
  computed_field: field_type

  # remote relationships
  remote_field: field_type
}

tableSelectionList :: (MonadBuildSchemaBase r m n, BackendTableSelectSchema b) => SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Output n (AnnotatedFields b))) Source #

List of table fields object. Just a nonNullableObjectList wrapper over tableSelectionSet. > table_name: [table!]!

nonNullableObjectList :: Parser 'Output m a -> Parser 'Output m a Source #

Converts an output type parser from object_type to [object_type!]!

tableConnectionSelectionSet :: forall b r m n. (MonadBuildSchema b r m n, BackendTableSelectSchema b) => SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Output n (ConnectionFields b))) Source #

Connection fields of a table

type tableConnection{
  pageInfo: PageInfo!
  edges: [tableEdge!]!
}
type PageInfo{
  startCursor: String!
  endCursor: String!
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
}
type tableEdge{
  cursor: String!
  node: table!
}

defaultTableArgs :: forall b r m n. (MonadBuildSchema b r m n, AggregationPredicatesSchema b) => SourceInfo b -> TableInfo b -> m (InputFieldsParser n (SelectArgs b)) Source #

Arguments for a table selection. Default implementation for BackendSchema.

distinct_on: [table_select_column!]
limit: Int
offset: Int
order_by: [table_order_by!]
where: table_bool_exp

tableWhereArg :: forall b r m n. (AggregationPredicatesSchema b, MonadBuildSchema b r m n) => SourceInfo b -> TableInfo b -> m (InputFieldsParser n (Maybe (AnnBoolExp b (UnpreparedValue b)))) Source #

Argument to filter rows returned from table selection > where: table_bool_exp

tableOrderByArg :: forall b r m n. MonadBuildSchema b r m n => SourceInfo b -> TableInfo b -> m (InputFieldsParser n (Maybe (NonEmpty (AnnotatedOrderByItemG b (UnpreparedValue b))))) Source #

Argument to sort rows returned from table selection > order_by: [table_order_by!]

tableDistinctArg :: forall b r m n. MonadBuildSchema b r m n => SourceInfo b -> TableInfo b -> m (InputFieldsParser n (Maybe (NonEmpty (Column b)))) Source #

Argument to distinct select on columns returned from table selection > distinct_on: [table_select_column!]

tableLimitArg :: forall n. MonadParse n => InputFieldsParser n (Maybe Int) Source #

Argument to limit rows returned from table selection > limit: NonNegativeInt

tableOffsetArg :: forall n. MonadParse n => InputFieldsParser n (Maybe Int64) Source #

Argument to skip some rows, in conjunction with order_by > offset: BigInt

tableConnectionArgs :: forall b r m n. (MonadBuildSchema b r m n, AggregationPredicatesSchema b) => PrimaryKeyColumns b -> SourceInfo b -> TableInfo b -> m (InputFieldsParser n (SelectArgs b, Maybe (NonEmpty (ConnectionSplit b (UnpreparedValue b))), Maybe ConnectionSlice)) Source #

Arguments for a table connection selection

distinct_on: [table_select_column!]
order_by: [table_order_by!]
where: table_bool_exp
first: Int
last: Int
before: String
after: String

tableAggregationFields :: forall b r m n. MonadBuildSchema b r m n => SourceInfo b -> TableInfo b -> m (Parser 'Output n (AggregateFields b)) Source #

Aggregation fields

type table_aggregate_fields{
  count(distinct: Boolean, columns: [table_select_column!]): Int!
  sum: table_sum_fields
  avg: table_avg_fields
  stddev: table_stddev_fields
  stddev_pop: table_stddev_pop_fields
  variance: table_variance_fields
  var_pop: table_var_pop_fields
  max: table_max_fields
  min: table_min_fields
}

fieldSelection :: forall b r m n. (AggregationPredicatesSchema b, BackendTableSelectSchema b, Eq (AnnBoolExp b (UnpreparedValue b)), MonadBuildSchema b r m n) => SourceInfo b -> TableName b -> TableInfo b -> FieldInfo b -> m [FieldParser n (AnnotatedField b)] Source #

An individual field of a table

field_name(arg_name: arg_type, ...): field_type

relationshipField :: forall b r m n. (AggregationPredicatesSchema b, BackendTableSelectSchema b, Eq (AnnBoolExp b (UnpreparedValue b)), MonadBuildSchema b r m n) => SourceInfo b -> TableName b -> RelInfo b -> m (Maybe [FieldParser n (AnnotatedField b)]) Source #

Field parsers for a table relationship