ash_graphql/lib/resource/subscription.ex
Barnabas Jovanovics 52dfa22afd wip
2024-08-26 11:40:52 +02:00

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