View runtime_benchmark.rb
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
# This benchmark aims to test GraphQL-Ruby's runtime performance | |
# _except_ for parsing. | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
# Pick a GraphQL version: | |
# gem "graphql", "1.13.19" | |
gem "graphql", "~>2.0" | |
gem "benchmark-ips" |
View legacy_changesets.rb
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", path: "./" | |
gem "graphql-enterprise", source: "https://gems.graphql.pro" | |
end | |
class BaseField < GraphQL::Schema::Field | |
include GraphQL::Enterprise::Changeset::FieldIntegration | |
end |
View union_spread.rb
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.11.2" | |
end | |
class Schema < GraphQL::Schema | |
class Error < GraphQL::Schema::Object | |
field :message, String, null: false | |
end |
View example.js
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
import { Client, defaultExchanges, subscriptionExchange } from 'urql' | |
import Pusher from "pusher" | |
const pusherClient = new Pusher("your-app-key", { cluster: "us2" }) | |
const forwardSubscriptionToPusher = (operation) => { | |
// urql will call `.subscribe` on the returned object: | |
// https://github.com/FormidableLabs/urql/blob/f89cfd06d9f14ae9cb3be10b21bd5cbd12ca275c/packages/core/src/exchanges/subscription.ts#L68-L73 | |
// https://github.com/FormidableLabs/urql/blob/f89cfd06d9f14ae9cb3be10b21bd5cbd12ca275c/packages/core/src/exchanges/subscription.ts#L82-L97 | |
return { | |
subscribe: ({next, error, complete}) => { |
View inline_fragments.rb
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", "~>2.0" | |
end | |
# This visitor will inline any fragment definitions in the document. | |
# It assumes that the document is valid; it will :boom: if there are | |
# cycles in the fragment spreads. |
View caching_test.rb
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.10" | |
gem "graphql-pro", "1.21.4" | |
gem "graphql-enterprise", "1.1.3" | |
end | |
class CachingSchema < GraphQL::Schema |
View relation_cache.rb
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" |
View global_id_changeset.rb
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 |
View scoping.rb
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 |
View example.rb
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.13.2" | |
gem "graphql-pro", "1.20.2" | |
gem "redis" | |
end | |
# In-memory cache: populate the cache after queries are run. |
NewerOlder