Sha256: 3b5b12e3a814e1b3ae2ad27b6756721494c406bb349c480b7bc8868ce4589421
Contents?: true
Size: 1.03 KB
Versions: 9
Compression:
Stored size: 1.03 KB
Contents
<%= schema_name %> = GraphQL::Schema.define do query(Types::QueryType) <% if options[:relay] %> # Relay Object Identification: # Return a string UUID for `object` id_from_object ->(object, type_definition, query_ctx) { # Here's a simple implementation which: # - joins the type name & object.id # - encodes it with base64: # GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id) } # Given a string UUID, find the object object_from_id ->(id, query_ctx) { # For example, to decode the UUIDs generated above: # type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id) # # Then, based on `type_name` and `id` # find an object in your application # ... } # Object Resolution resolve_type -> (obj, ctx) { # TODO: Implement this function # to return the correct type for `obj` raise(NotImplementedError) } <% end %><% if options[:batch] %> # GraphQL::Batch setup: lazy_resolve(Promise, :sync) instrument(:query, GraphQL::Batch::Setup) <% end %>end
Version data entries
9 entries across 9 versions & 1 rubygems