You're seeing just the macro derive_connection, go back to Cqrs.Absinthe.Relay module for more information.
Link to this macro

derive_connection(query_module, return_type, opts)

View Source (macro)

Creates an Absinthe.Relay.Connection query from a Command.


  • :repo - The Ecto.Repo to use for the connection. Defaults to the configured repo in :cqrs_tools, :absinthe_relay.
  • :repo_fun - The function of the :repo to run. Defaults to :all
  • :as - The name to use for the query. Defaults to the query_module name snake_cased.
  • :only - Use only the filters listed
  • :except - Create filters for all except those listed
  • :arg_types - A list of filter names to absinthe types. See example.
  • :before_resolve - Absinthe Middleware to run before the resolver.
  • :after_resolve - Absinthe Middleware to run after the resolver.
  • :parent_mappings - A keyword list of query filters to functions that receive the field's parent object as an argument.
  • :filter_transforms - A keyword list of query filters to functions that receive the filter's current value as an argument.


defmodule ExampleApi.Types.UserTypes do
  @moduledoc false
  use Cqrs.Absinthe.Relay

  use Absinthe.Schema.Notation
  use Absinthe.Relay.Schema.Notation, :modern

  alias Example.Queries.ListUsers

  enum :user_status do
    value :active
    value :suspended

  object :user do
    field :id, :id
    field :name, :string
    field :email, :string
    field :status, :user_status

    derive_connection GetUserFriends, :user,
      as: :friends,
      repo: Example.Repo,
      parent_mappings: [user_id: fn %{id: id} -> id end]

  connection(node_type: :user)

  object :user_queries do
    derive_connection ListUsers, :user,
      as: :users,
      repo: Example.Repo,
      arg_types: [status: :user_status]