Grephql.Types.Typename (Grephql v0.10.1)

Copy Markdown View Source

Parameterized Ecto Type for GraphQL __typename fields.

Converts GraphQL type name strings (e.g., "User", "SearchResult") to snake_cased Elixir atoms (e.g., :user, :search_result).

The string-to-atom mapping is pre-computed at compile time in init/1. At runtime, cast/2 and load/3 perform only a Map.fetch/2 lookup.

Usage in schema

field :__typename, Grephql.Types.Typename, values: ["User", "Post"]

Ecto calls init/1 automatically with the field options.

Summary

Types

t()

@type t() :: atom()