GraphqlQuery.Fragment (graphql_query v0.3.7)

View Source

Struct representation of a GraphQL fragment.

Summary

Functions

Converts a GraphQL Document struct into a Fragment struct.

Types

t()

@type t() :: %GraphqlQuery.Fragment{
  document_info: GraphqlQuery.DocumentInfo.t() | nil,
  format: boolean(),
  fragment: String.t(),
  ignore?: boolean(),
  location: keyword() | nil,
  name: String.t(),
  path: String.t() | nil,
  schema: module() | nil
}

Functions

from_query(document)

Converts a GraphQL Document struct into a Fragment struct.

Takes a Document that was created with type: :fragment and converts it to the appropriate Fragment representation.

Examples

iex> document = GraphqlQuery.Document.new("fragment UserData on User { id name }", name: "UserData", type: :query)
iex> fragment = GraphqlQuery.Fragment.from_query(document)
iex> fragment.name
"UserData"
iex> fragment.fragment
"fragment UserData on User { id name }"

set_document_info(fragment, document_info)

@spec set_document_info(t(), GraphqlQuery.DocumentInfo.t() | nil) :: t()