-
-
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.
Merge pull request #215 from supabase/docs_kaizen
Docs Update
- Loading branch information
Showing
8 changed files
with
1,369 additions
and
158 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 @@ | ||
The following is a complete example showing how a sample SQL schema translates into a GraphQL schema. | ||
|
||
```sql | ||
--8<-- "docs/assets/demo_schema.sql" | ||
``` | ||
|
||
```graphql | ||
--8<-- "docs/assets/demo_schema.graphql" | ||
``` |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mkdocs | ||
mkdocs-material | ||
git+https://github.com/ivome/pygments-graphql-lexer.git |
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,60 @@ | ||
pg_graphql's public facing SQL interface consists of a single SQL function to resolve GraphQL requests. All other entities in the `graphql` schema are private. | ||
|
||
|
||
### graphql.resolve | ||
|
||
##### description | ||
Resolves a GraphQL query, returning JSONB. | ||
|
||
##### signature | ||
```sql | ||
graphql.resolve( | ||
-- graphql query/mutation | ||
query text, | ||
-- json key/values pairs for variables | ||
variables jsonb default '{}'::jsonb, | ||
-- the name of the graphql operation in *query* to execute | ||
"operationName" text default null, | ||
-- extensions to include in the request | ||
extensions jsonb default null, | ||
) | ||
returns jsonb | ||
|
||
strict | ||
volatile | ||
parallel safe | ||
language plpgsql | ||
``` | ||
|
||
##### usage | ||
|
||
```sql | ||
-- Create the extension | ||
graphqldb= create extension pg_graphql; | ||
CREATE EXTENSION | ||
|
||
-- Create an example table | ||
graphqldb= create table book(id int primary key, title text); | ||
CREATE TABLE | ||
|
||
-- Insert a record | ||
graphqldb= insert into book(id, title) values (1, 'book 1'); | ||
INSERT 0 1 | ||
|
||
-- Query the table via GraphQL | ||
graphqldb= select graphql.resolve($$ | ||
query { | ||
bookCollection { | ||
edges { | ||
node { | ||
id | ||
} | ||
} | ||
} | ||
} | ||
$$); | ||
|
||
resolve | ||
---------------------------------------------------------------------- | ||
{"data": {"bookCollection": {"edges": [{"node": {"id": 1}}]}}, "errors": []} | ||
``` |
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