This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql" | |
gem "graphql-pro" | |
gem "sqlite3" | |
gem "rails" | |
end | |
require "rails/all" | |
require "logger" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "1.13.2" | |
gem "graphql-enterprise", "1.1.0" | |
end | |
class BaseField < GraphQL::Schema::Field | |
include GraphQL::Enterprise::Changeset::FieldIntegration | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "1.13.1" | |
gem "graphql-pro" | |
end | |
class Schema < GraphQL::Schema | |
class BaseObject < GraphQL::Schema::Object | |
include GraphQL::Pro::PunditIntegration::ObjectIntegration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
require "logger" | |
gemfile do | |
gem "graphql", "2.2.10" | |
gem "graphql-pro", "1.26.3" | |
gem "redis" | |
end | |
# In-memory cache: populate the cache after queries are run. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "1.13.0" | |
gem "graphql-pro", "1.20.3" | |
gem "pundit" | |
end | |
require "ostruct" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "1.12.20" | |
end | |
class PreventNestedCards < GraphQL::Analysis::AST::Analyzer | |
def initialize(query) | |
super | |
@inside_players_selection = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "1.12.20" | |
gem "graphql-pro", "1.20.2" | |
gem "rails" | |
gem "sqlite3" | |
end | |
require "active_record" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
require "logger" | |
gemfile do | |
gem "graphql", "1.12.19" | |
gem "graphql-pro", "1.20.1" | |
gem "redis" | |
end | |
# Here's an example of caching parsed AST documents for persisted queries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "1.12.18" | |
end | |
class Schema < GraphQL::Schema | |
class Thing < GraphQL::Schema::Object | |
field :name, String, null: true | |
field :other_thing, self, null: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# | |
# LRU cache based on Ruby 1.9+ ordered hash inspired by Sam Saffron: https://stackoverflow.com/a/16161783 | |
# | |
# @example Caching valid query documents in a Rails controller | |
# | |
# class GraphqlController < ApplicationController | |
# # TODO: not thread-safe. See https://github.com/samsaffron/lru_redux for a thread-safe LRU cache | |
# PARSED_QUERY_CACHE = GraphQLParseAndValidateCache.new(schema: MySchema, max_entries: 20) | |
# |