View Source Bonfire.API.GraphQL.Fields (Bonfire v0.9.11-social-beta.6)

Summary

Functions

Returns the result corresponding to the given key, or the given default (or nil).

Returns a post-batch callback function which calls get with the provided key and optional default value (or nil).

Creates a new Fields from the data and a grouping function

Types

t()

@type t() :: %Bonfire.API.GraphQL.Fields{data: map()}

Functions

get(fields, key, default \\ nil)

@spec get(fields :: t(), key :: term(), default :: term()) :: term()

Returns the result corresponding to the given key, or the given default (or nil).

getter(key, default \\ nil)

@spec getter(key :: term(), default :: term()) :: (%{required(term()) => term()} ->
                                               term())

Returns a post-batch callback function which calls get with the provided key and optional default value (or nil).

new(data, group_fn)

@spec new(data :: [term()], group_fn :: (term() -> term())) :: t()

Creates a new Fields from the data and a grouping function

new(data, group_fn, map_fn)

@spec new(
  data :: [term()],
  group_fn :: (term() -> term()),
  map_fn :: (term() -> term())
) :: t()