ash_graphql v0.10.0 AshGraphql.Resource View Source
This Ash resource extension adds configuration for exposing a resource in a graphql.
Table of Contents
- graphql
- queries
- get
- list
- mutations
- create
- update
- destroy
- queries
graphql
Configuration for a given resource in graphql
Examples:
graphql do
type :post
queries do
get :get_post, :default
list :list_posts, :default
end
mutations do
create :create_post, :default
update :update_post, :default
destroy :destroy_post, :default
end
end
:type
- Required. The type to use for this entity in the graphql schema:primary_key_delimiter
- If a composite primary key exists, this must be set to determine theid
field value
queries
Queries (read actions) to expose for the resource.
Examples:
queries do
get :get_post, :default
list :list_posts, :default
end
get
A query to fetch a record by primary key
Introspection Target:
Examples:
get :get_post, :default
:name
- The name to use for the query. The default value is:get
.:action
- Required. The action to use for the query.:identity
- false The identity to use for looking up the user
list
A query to fetch a list of records
Introspection Target:
Examples:
list :list_posts, :default
:name
- The name to use for the query. The default value is:list
.:action
- Required. The action to use for the query.
mutations
Mutations (create/update/destroy actions) to expose for the resource.
Examples:
mutations do
create :create_post, :default
update :update_post, :default
destroy :destroy_post, :default
end
create
A mutation to create a record
Introspection Target:
Examples:
create :create_post, :default
:name
- The name to use for the mutation. The default value is:get
.:action
- Required. The action to use for the mutation.
update
A mutation to update a record
Introspection Target:
Examples:
update :update_post, :default
:name
- The name to use for the mutation. The default value is:get
.:action
- Required. The action to use for the mutation.:identity
- The identity to use to fetch the record to be updated.
destroy
A mutation to destroy a record
Introspection Target:
Examples:
destroy :destroy_post, :default
:name
- The name to use for the mutation. The default value is:get
.:action
- Required. The action to use for the mutation.:identity
- The identity to use to fetch the record to be destroyed.