Skip to content

Commit 947bd40

Browse files
authored
Support Ecto 2.x (#23)
* Support Ecto 2.x Update to support Ecto 2.x. We may still move Ecto support into a separate library, however for now this works for both Ecto 1.x and 2.x. This commit also includes some minor documentation updates. The documentation still needs plenty of help but I did not want to hold up the Ecto 2.x support for this task. This also includes a CHANGELOG entry in preparation for release of a new version due to an API update and soft deprecation. * Release v0.4.0
1 parent 44e6912 commit 947bd40

File tree

19 files changed

+196
-98
lines changed

19 files changed

+196
-98
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

3+
## 0.4.0 (2016-06-22)
4+
5+
* Update optional dependency for Ecto to support both Ecto v1.x and v2.x.
6+
* Add `GraphQL.Relay.Connection.Ecto.resolve/3` and include deprecation warning for `GraphQL.Relay.Connection.Ecto.resolve/2`. It makes no sense to add your Ecto Repo to `args`. You can now pass it directly as the first argument, which makes much more sense. `GraphQL.Relay.Connection.Ecto.resolve(Repo, query)` not `GraphQL.Relay.Connection.Ecto.resolve(query, %{repo: Repo})`.
7+
38
## 0.3.0 (2016-06-09)
49

510
* Bump version to match GraphQL Elixir
6-
* Update dependencies to v0.3.1 of GraphQL Elixir
11+
* Update dependencies to v0.3 of GraphQL Elixir

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This library relies on the [GraphQL Elixir](https://github.com/graphql-elixir/gr
1111
Add `graphql_relay` to your list of dependencies in `mix.exs`:
1212

1313
def deps do
14-
[{:graphql_relay, "~> 0.3"}]
14+
[{:graphql_relay, "~> 0.4"}]
1515
end
1616

1717
## Configuration

RELEASE.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ This document outlines the release process:
1010

1111
4. Run `mix test` to ensure all tests pass
1212

13-
5. Commit changes above with title "Release vVERSION" and push to GitHub
13+
5. Update `examples` to use new version
14+
15+
6. Commit changes above with title "Release vVERSION" and push to GitHub
1416

1517
git add .
1618
git commit -m"Release vX.Y.Z"
1719
git push origin master
1820

19-
6. Check CI is green
21+
7. Check CI is green
2022

21-
7. Create a release on GitHub and add the CHANGELOG from step #2 (https://github.com/graphql-elixir/graphql/releases/new) using VERSION as the tag and title
23+
8. Create a release on GitHub and add the CHANGELOG from step #2 (https://github.com/graphql-elixir/graphql/releases/new) using VERSION as the tag and title
2224

23-
8. Publish new hex release with `mix hex.publish`
25+
9. Publish new hex release with `mix hex.publish`
2426

25-
9. Publish hex docs with `mix hex.docs`
27+
10. Publish hex docs with `mix hex.docs`
2628

2729
## Deprecation policy
2830

config/test.exs

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
use Mix.Config
22

3-
# config :graphql_relay, GraphQL.Relay.Connection.EctoTest.Repo,
4-
# adapter: Ecto.Adapters.Postgres,
5-
# database: "graphql_relay_test",
6-
# username: "postgres",
7-
# password: "postgres",
8-
# hostname: "localhost"
3+
# Ecto v1.x
4+
# config :graphql_relay, app_repo: EctoTest.Repo
5+
6+
# Ecto v2.x
7+
config :graphql_relay, ecto_repos: [EctoTest.Repo]
98

10-
config :graphql_relay, app_repo: EctoTest.Repo
119
config :graphql_relay, EctoTest.Repo,
12-
adapter: Sqlite.Ecto,
13-
database: ":memory:",
10+
adapter: Ecto.Adapters.Postgres,
11+
database: "graphql_relay_test",
12+
username: "postgres",
13+
password: "postgres",
14+
hostname: "localhost",
1415
pool: Ecto.Adapters.SQL.Sandbox

examples/todo/mix.exs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Todo.Mixfile do
33

44
def project do
55
[app: :todo,
6-
version: "0.0.1",
6+
version: "0.1.0",
77
elixir: "~> 1.0",
88
elixirc_paths: elixirc_paths(Mix.env),
99
compilers: [:phoenix] ++ Mix.compilers,
@@ -30,14 +30,14 @@ defmodule Todo.Mixfile do
3030
#
3131
# Type `mix help deps` for examples and options.
3232
defp deps do
33-
[{:phoenix, "~> 1.1.4"},
34-
{:phoenix_ecto, "~> 2.0"},
35-
{:postgrex, "~> 0.11"},
36-
{:phoenix_html, "~> 2.3"},
33+
[{:phoenix, "~> 1.1.6"},
34+
{:phoenix_ecto, "~> 3.0"},
35+
{:postgrex, ">= 0.0.0"},
36+
{:phoenix_html, "~> 2.6"},
3737
{:phoenix_live_reload, "~> 1.0", only: :dev},
3838
{:cowboy, "~> 1.0"},
39-
{:graphql_relay, "~> 0.0.17"},
40-
{:plug_graphql, "~> 0.3.0"}]
39+
{:graphql_relay, "~> 0.4"},
40+
{:plug_graphql, "~> 0.3"}]
4141
end
4242

4343
# Aliases are shortcut or tasks specific to the current project.

examples/todo/mix.lock

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
%{"connection": {:hex, :connection, "1.0.2", "f4a06dd3ecae4141aa66f94ce92ea4c4b8753069472814932f1cadbc3078ab80", [:mix], []},
1+
%{"connection": {:hex, :connection, "1.0.3", "3145f7416be3df248a4935f24e3221dc467c1e3a158d62015b35bd54da365786", [:mix], []},
22
"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]},
33
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []},
4-
"db_connection": {:hex, :db_connection, "0.2.5", "3e5e28019e0ec744345568d22a2f5206109bff0e2571f4d7819e0d14cf955f3e", [:mix], [{:sbroker, "~> 0.7", [hex: :sbroker, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:connection, "~> 1.0.2", [hex: :connection, optional: false]}]},
4+
"db_connection": {:hex, :db_connection, "1.0.0-rc.2", "c5b2329651ef046d85e47ec2c947cb0e3d10a69eb49fdb71e365e72d6758e4c5", [:mix], [{:sbroker, "~> 1.0.0-beta.2", [hex: :sbroker, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:connection, "~> 1.0.2", [hex: :connection, optional: false]}]},
55
"decimal": {:hex, :decimal, "1.1.2", "79a769d4657b2d537b51ef3c02d29ab7141d2b486b516c109642d453ee08e00c", [:mix], []},
6-
"ecto": {:hex, :ecto, "1.1.7", "c37127248756e725eb8254b371764b40c05a90c104b2065d1d4f7e32573fdbec", [:mix], [{:sbroker, "~> 0.7", [hex: :sbroker, optional: true]}, {:postgrex, "~> 0.11.0", [hex: :postgrex, optional: true]}, {:poolboy, "~> 1.4", [hex: :poolboy, optional: false]}, {:poison, "~> 1.0 or ~> 2.0", [hex: :poison, optional: true]}, {:mariaex, "~> 0.5.0 or ~> 0.6.0", [hex: :mariaex, optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}]},
6+
"ecto": {:hex, :ecto, "2.0.1", "cf97a4d353e14af3d3cc3b4452cfbd18b3aeee1fb4075475efeccec3853444a9", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: true]}, {:sbroker, "~> 1.0-beta", [hex: :sbroker, optional: true]}, {:mariaex, "~> 0.7.7", [hex: :mariaex, optional: true]}, {:postgrex, "~> 0.11.2", [hex: :postgrex, optional: true]}, {:db_connection, "~> 1.0-rc.2", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}]},
77
"fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], []},
8-
"graphql": {:hex, :graphql, "0.3.0", "4894f81e0010ff04a0349845f63a19f7f8cce754273bb06ecfe00b30dc685a86", [:mix], []},
8+
"graphql": {:hex, :graphql, "0.3.1", "d3bb5467877456cc2b33debc75407e9216567b10e35e83d5195e2d51e835e8c7", [:mix], []},
99
"graphql_relay": {:hex, :graphql_relay, "0.0.17", "d5ce633b85c9103ab0507dd3c4e9103d8d14ea9bd316d35fb9cbc9ba31234c5c", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:graphql, "~> 0.3", [hex: :graphql, optional: false]}, {:ecto, "~> 1.1.4", [hex: :ecto, optional: true]}]},
10-
"phoenix": {:hex, :phoenix, "1.1.4", "65809fba92eb94377372a5fb5a561197654bb8406e773cc47ca1a031bbe58019", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]},
11-
"phoenix_ecto": {:hex, :phoenix_ecto, "2.0.2", "1aff51d1cd21cc39d7891cae2284399cbf4b8e32fb7864e68f5d272d2934e48a", [:mix], [{:poison, "~> 1.3 or ~> 2.0", [hex: :poison, optional: true]}, {:phoenix_html, "~> 2.2", [hex: :phoenix_html, optional: true]}, {:ecto, "~> 1.1.2", [hex: :ecto, optional: false]}]},
12-
"phoenix_html": {:hex, :phoenix_html, "2.5.1", "631053f9e345fecb5c87d9e0ccd807f7266d27e2ee4269817067af425fd81ba8", [:mix], [{:plug, "~> 0.13 or ~> 1.0", [hex: :plug, optional: false]}]},
10+
"phoenix": {:hex, :phoenix, "1.1.6", "7bf19002669c8f692f5a9c8d30dab7b49f3dc56228d5bde92a12fb426b4783c2", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]},
11+
"phoenix_ecto": {:hex, :phoenix_ecto, "3.0.0", "b947aaf03d076f5b1448f87828f22fb7710478ee38455c67cc3fe8e9a4dfd015", [:mix], [{:ecto, "~> 2.0.0-rc", [hex: :ecto, optional: false]}, {:phoenix_html, "~> 2.6", [hex: :phoenix_html, optional: true]}]},
12+
"phoenix_html": {:hex, :phoenix_html, "2.6.0", "b9f7e091eb3d908586d9634596478fb9e577ee033d76f4ff327a745569bdd2d8", [:mix], [{:plug, "~> 0.13 or ~> 1.0", [hex: :plug, optional: false]}]},
1313
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.0.5", "829218c4152ba1e9848e2bf8e161fcde6b4ec679a516259442561d21fde68d0b", [:mix], [{:phoenix, "~> 1.0 or ~> 1.2-rc", [hex: :phoenix, optional: false]}, {:fs, "~> 0.9.1", [hex: :fs, optional: false]}]},
14-
"plug": {:hex, :plug, "1.1.5", "de5645c18170415a72b18cc3d215c05321ddecac27a15acb923742156e98278b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]},
15-
"plug_graphql": {:hex, :plug_graphql, "0.3.0", "17952a585b4eaf1a7941ab4fbfca8f812fdc897905fa616cde72135a479b5dc1", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:plug, "~> 0.14 or ~> 1.0", [hex: :plug, optional: false]}, {:graphql, "~> 0.3", [hex: :graphql, optional: false]}, {:cowboy, "~> 1.0", [hex: :cowboy, optional: false]}]},
16-
"poison": {:hex, :poison, "2.1.0", "f583218ced822675e484648fa26c933d621373f01c6c76bd00005d7bd4b82e27", [:mix], []},
14+
"plug": {:hex, :plug, "1.1.6", "8927e4028433fcb859e000b9389ee9c37c80eb28378eeeea31b0273350bf668b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]},
15+
"plug_graphql": {:hex, :plug_graphql, "0.3.1", "8c3c91b889236620cea19606ab5b770c1c533242c92d97c23b9f359be4eb4c03", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:plug, "~> 0.14 or ~> 1.0", [hex: :plug, optional: false]}, {:graphql, "~> 0.3", [hex: :graphql, optional: false]}, {:cowboy, "~> 1.0", [hex: :cowboy, optional: false]}]},
16+
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], []},
1717
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []},
18-
"postgrex": {:hex, :postgrex, "0.11.1", "f48af70c0a58b9bfd1aaa456ec4273624554cfb837726b6a7f0701da4a94b2dd", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:db_connection, "~> 0.2", [hex: :db_connection, optional: false]}, {:connection, "~> 1.0", [hex: :connection, optional: false]}]},
18+
"postgrex": {:hex, :postgrex, "0.11.2", "139755c1359d3c5c6d6e8b1ea72556d39e2746f61c6ddfb442813c91f53487e8", [:mix], [{:connection, "~> 1.0", [hex: :connection, optional: false]}, {:db_connection, "~> 1.0-rc", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}]},
1919
"ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []}}

examples/todo/web/graphql/todo.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ defmodule Todo.GraphQL.Schema.Todo do
224224
end
225225
},
226226
},
227-
mutate_and_get_payload: fn(input, _info) ->
227+
mutate_and_get_payload: fn(_input, _info) ->
228228
# [_, user_id] = Node.from_global_id(input["viewer"]["id"])
229229
todos = Todo.GraphQL.Schema.Todo.delete_completed(1)
230230
%{

examples/todo/web/graphql/user.ex

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ defmodule Todo.GraphQL.Schema.User do
2626
Connection.args
2727
),
2828
resolve: fn(user, args, _ctx) ->
29-
args = Map.put(args, :repo, Repo)
3029
query = Ecto.assoc(user, :todos)
3130
query = case args do
3231
%{status: "active"} -> from things in query, where: things.complete == false
3332
%{status: "completed"} -> from things in query, where: things.complete == true
3433
_ -> query
3534
end
36-
Connection.Ecto.resolve(query, args)
35+
Connection.Ecto.resolve(Repo, query, args)
3736
end
3837
},
3938
totalCount: %{

lib/graphql/relay/connection.ex

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
defmodule GraphQL.Relay.Connection do
2-
@doc """
3-
Any type whose name ends in "Connection" is considered by Relay to be a
4-
Connection Type. Connection types must be an "Object" as defined in the
5-
"Type System" section of the GraphQL Specification.
2+
@moduledoc """
3+
You define a Connection for Relay when you want a paginated data source.
64
7-
Connection types must have fields named edges and pageInfo. They may have
8-
additional fields related to the connection, as the schema designer sees fit.
5+
For example, in a Todo application a User can have many Todos that you want
6+
to list and paginate through. A Connection is the perfect fit for this.
97
10-
https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types
8+
For an example see https://github.com/graphql-elixir/graphql_relay/blob/44e6912a08468743f7dfa1343723914bbf6809e1/examples/todo/web/graphql/user.ex
9+
10+
For the Connection type specification see: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types
1111
"""
1212
alias GraphQL.Type.Boolean
1313
alias GraphQL.Type.Int

lib/graphql/relay/connection/ecto.ex

+74-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,63 @@
11
if Code.ensure_loaded?(Ecto) do
22
defmodule GraphQL.Relay.Connection.Ecto do
33
@moduledoc """
4-
Interface between Relay Connections and Ecto Queries.
5-
6-
In other words, this module allows you to back a Relay Connection with an
7-
Ecto query.
4+
Interface between Relay Connections and Ecto. This module allows you to
5+
back a Relay Connection with an Ecto query.
6+
7+
## Example
8+
9+
A Relay connection starts with a connection definition. For example, a
10+
`user` can have many `todos` (see code comments):
11+
12+
```elixir
13+
%ObjectType{
14+
name: "User",
15+
description: "The user",
16+
fields: %{
17+
id: Node.global_id_field("user"),
18+
name: %{type: %String{}},
19+
email: %{type: %String{}},
20+
todos: %{
21+
type: Todo.connection[:connection_type],
22+
description: "The todos this user owns",
23+
args: Map.merge(
24+
%{status: %{type: %String{}, defaultValue: "any"}},
25+
Connection.args
26+
),
27+
resolve: fn(user, args, _ctx) ->
28+
# Here we prepare our Ecto query
29+
query = Ecto.assoc(user, :todos)
30+
query = case args do
31+
%{status: "active"} -> from things in query, where: things.complete == false
32+
%{status: "completed"} -> from things in query, where: things.complete == true
33+
_ -> query
34+
end
35+
# Here we resolve the connection using our Ecto Connection module,
36+
# passing it the Ecto Repo we want to query. The `resolve/3` function
37+
# will execute the query and return the results in the form Relay
38+
# requires.
39+
Connection.Ecto.resolve(Repo, query, args)
40+
end
41+
},
42+
},
43+
interfaces: [Root.node_interface]
44+
}
45+
```
46+
For a full example see https://github.com/graphql-elixir/graphql_relay/blob/master/examples/todo/web/graphql/user.ex
847
"""
948
import Ecto.Query
1049
@prefix "ectoconnection:"
1150

51+
@doc """
52+
WARNING: this function signature is deprecated. Use `resolve/3`.
53+
"""
1254
def resolve(query, %{repo: repo} = args) do
55+
# Emit deprecation warning once we hit >= v0.6 per RELEASE.md#Deprecations
56+
# :elixir_errors.warn __ENV__.line, __ENV__.file, "Use of `GraphQL.Relay.Connection.Ecto.resolve/2` is deprecated! Use `GraphQL.Relay.Connection.Ecto.resolve/3`."
57+
resolve(repo, query, args)
58+
end
59+
60+
def resolve(repo, query, args \\ %{}) do
1361
before = cursor_to_offset(args[:before])
1462
# `after` is a keyword http://elixir-lang.org/docs/master/elixir/Kernel.SpecialForms.html#try/1
1563
a_after = cursor_to_offset(args[:after])
@@ -111,20 +159,36 @@ if Code.ensure_loaded?(Ecto) do
111159

112160
defp make_query_countable(query) do
113161
query
114-
|> remove_select
115162
|> remove_order
163+
|> remove_preload
164+
|> remove_select
165+
end
166+
167+
# Remove order by if it exists so that we avoid `field X in "order_by"
168+
# does not exist in the model source in query`
169+
defp remove_order(query) do
170+
Ecto.Query.exclude(query, :order_by)
171+
end
172+
173+
# Remove preload if it exists so that we avoid "the binding used in `from`
174+
# must be selected in `select` when using `preload` in query`"
175+
defp remove_preload(query) do
176+
Ecto.Query.exclude(query, :preload)
116177
end
117178

118179
# Remove select if it exists so that we avoid `only one select
119180
# expression is allowed in query` Ecto exception
120181
defp remove_select(query) do
121182
Ecto.Query.exclude(query, :select)
122183
end
123-
124-
# Remove order by if it exists so that we avoid `field X in "order_by"
125-
# does not exist in the model source in query`
126-
defp remove_order(query) do
127-
Ecto.Query.exclude(query, :order_by)
184+
end
185+
else
186+
defmodule GraphQL.Relay.Connection.Ecto do
187+
def resolve(_, _) do
188+
raise RuntimeError, message: """
189+
Ecto not available. Make sure Ecto is installed as a dependency of your
190+
application.
191+
"""
128192
end
129193
end
130194
end

lib/graphql/relay/connection/list.ex

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
defmodule GraphQL.Relay.Connection.List do
2+
@moduledoc """
3+
Interface between Relay Connections and a list. This module allows you to
4+
back a Relay Connection with a common list.
5+
6+
See tests for examples https://github.com/graphql-elixir/graphql_relay/blob/master/test/graphql/relay/connection/list_test.exs
7+
"""
28
@prefix "arrayconnection:"
39

410
def resolve(data), do: resolve(data, %{})

lib/graphql/relay/mutation.ex

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ defmodule GraphQL.Relay.Mutation do
88
then returned as part of the object returned by the mutation field.
99
1010
https://facebook.github.io/relay/graphql/mutations.htm
11+
12+
For an example see https://github.com/graphql-elixir/graphql_relay/blob/44e6912a08468743f7dfa1343723914bbf6809e1/examples/todo/web/graphql/todo.ex#L110
1113
"""
1214
alias GraphQL.Type.NonNull
1315
alias GraphQL.Type.ObjectType

lib/graphql/relay/node.ex

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
defmodule GraphQL.Relay.Node do
22
@doc """
3-
Relay’s support for object identification relies on the GraphQL server exposing object identifiers in a standardized way. In the query, the schema should provide a standard mechanism for asking for an object by ID. In the response, the schema provides a standard way of providing these IDs.
3+
Relay’s support for object identification relies on the GraphQL server
4+
exposing object identifiers in a standardized way. In the query, the schema
5+
should provide a standard mechanism for asking for an object by ID. In the
6+
response, the schema provides a standard way of providing these IDs.
47
58
We refer to objects with identifiers as “nodes”.
69
710
http://facebook.github.io/relay/graphql/objectidentification.htm
11+
12+
For an example see https://github.com/graphql-elixir/graphql_relay/blob/44e6912a08468743f7dfa1343723914bbf6809e1/examples/todo/web/graphql/root.ex#L6
813
"""
914
alias GraphQL.Type.ID
1015
alias GraphQL.Type.Interface

lib/graphql_relay.ex

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
defmodule GraphQL.Relay do
2-
require Logger
3-
42
@moduledoc """
53
Elixir library containing helpers for making a GraphQL server Relay compliant.
64
"""
5+
require Logger
76

87
@spec resolve_maybe_thunk(fun | map) :: %{}
98
def resolve_maybe_thunk(t) when is_function(t), do: t.()

mix.exs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule GraphQL.Relay.Mixfile do
22
use Mix.Project
33

4-
@version "0.3.0"
4+
@version "0.4.0"
55
@description "Relay helpers for GraphQL Elixir"
66
@repo_url "https://github.com/graphql-elixir/graphql_relay"
77

@@ -34,8 +34,8 @@ defmodule GraphQL.Relay.Mixfile do
3434
[
3535
{:graphql, "~> 0.3"},
3636
{:poison, "~> 1.5 or ~> 2.0"}, # For .generate_schema_json!
37-
{:ecto, "~> 1.1.4", optional: true},
38-
{:sqlite_ecto, "~> 1.0.0", only: [:dev, :test]},
37+
{:ecto, "~> 1.0 or ~> 2.0", optional: true, only: [:dev, :test]},
38+
{:postgrex, ">= 0.0.0", only: [:dev, :test]},
3939
]
4040
end
4141

0 commit comments

Comments
 (0)