-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable fragments on top level query/mutation (#272)
- Loading branch information
Showing
5 changed files
with
148 additions
and
20 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
begin; | ||
create table blog_post( | ||
id int primary key, | ||
title text not null | ||
); | ||
select graphql.resolve($$ | ||
mutation { | ||
...blogPosts_insert | ||
} | ||
|
||
fragment blogPosts_insert on Mutation { | ||
insertIntoBlogPostCollection(objects: [ | ||
{ id: 1, title: "foo" } | ||
]) { | ||
affectedCount | ||
records { | ||
id | ||
title | ||
} | ||
} | ||
} | ||
$$); | ||
resolve | ||
---------------------------------------------------------------------------------------------------------- | ||
{"data": {"insertIntoBlogPostCollection": {"records": [{"id": 1, "title": "foo"}], "affectedCount": 1}}} | ||
(1 row) | ||
|
||
select * from blog_post; | ||
id | title | ||
----+------- | ||
1 | foo | ||
(1 row) | ||
|
||
rollback; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
begin; | ||
create table blog_post( | ||
id int primary key, | ||
title text not null | ||
); | ||
select graphql.resolve($$ | ||
query { | ||
...blogPosts_query | ||
} | ||
|
||
fragment blogPosts_query on Query { | ||
blogPostCollection(first:2) { | ||
edges | ||
{ | ||
node { | ||
id | ||
title | ||
} | ||
} | ||
} | ||
} | ||
$$); | ||
resolve | ||
------------------------------------------------- | ||
{"data": {"blogPostCollection": {"edges": []}}} | ||
(1 row) | ||
|
||
rollback; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
begin; | ||
|
||
create table blog_post( | ||
id int primary key, | ||
title text not null | ||
); | ||
|
||
select graphql.resolve($$ | ||
mutation { | ||
...blogPosts_insert | ||
} | ||
|
||
fragment blogPosts_insert on Mutation { | ||
insertIntoBlogPostCollection(objects: [ | ||
{ id: 1, title: "foo" } | ||
]) { | ||
affectedCount | ||
records { | ||
id | ||
title | ||
} | ||
} | ||
} | ||
$$); | ||
|
||
select * from blog_post; | ||
|
||
rollback; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
begin; | ||
|
||
create table blog_post( | ||
id int primary key, | ||
title text not null | ||
); | ||
|
||
select graphql.resolve($$ | ||
query { | ||
...blogPosts_query | ||
} | ||
|
||
fragment blogPosts_query on Query { | ||
blogPostCollection(first:2) { | ||
edges | ||
{ | ||
node { | ||
id | ||
title | ||
} | ||
} | ||
} | ||
} | ||
$$); | ||
|
||
rollback; |