mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 13:24:14 +12:00
34 lines
909 B
Elixir
34 lines
909 B
Elixir
defmodule AshGraphql.Resource.Subscription do
|
|
@moduledoc "Represents a configured query on a resource"
|
|
defstruct [
|
|
:name,
|
|
:config,
|
|
:resolve
|
|
]
|
|
|
|
@subscription_schema [
|
|
name: [
|
|
type: :atom,
|
|
doc: "The name to use for the subscription."
|
|
],
|
|
config: [
|
|
type:
|
|
{:spark_function_behaviour, AshGraphql.Resource.Subscription.Config,
|
|
{AshGraphql.Resource.Subscription.Config.Function, 2}},
|
|
doc: """
|
|
Function that creates the config for the subscription
|
|
"""
|
|
],
|
|
resolve: [
|
|
type:
|
|
{:spark_function_behaviour, AshGraphql.Resource.Subscription.Resolve,
|
|
{AshGraphql.Resource.Subscription.Resolve.Function, 3}},
|
|
doc: """
|
|
Function that creates the config for the subscription
|
|
""",
|
|
default: AshGraphql.Resource.Subscription.DefaultResolve
|
|
]
|
|
]
|
|
|
|
def schema, do: @subscription_schema
|
|
end
|