Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release v0.2.0 #146

Merged
merged 8 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = pg_graphql
DATA = pg_graphql--0.1.5.sql
DATA = pg_graphql--0.2.0.sql

PG_CONFIG = pg_config
SHLIB_LINK = -lgraphqlparser
Expand Down
2 changes: 1 addition & 1 deletion bin/common
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export PG_GRAPHQL_VERSION='0.1.5'
export PG_GRAPHQL_VERSION='0.2.0'

cli_log() {
script_name=${0##*/}
Expand Down
14 changes: 12 additions & 2 deletions dockerfiles/db/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ alter default privileges in schema graphql grant all on sequences to anon;


-- GraphQL Entrypoint
create function graphql("operationName" text default null, query text default null, variables jsonb default null)
create function graphql(
"operationName" text default null,
query text default null,
variables jsonb default null,
extensions jsonb default null
)
returns jsonb
language sql
as $$
select graphql.resolve(query, coalesce(variables, '{}'));
select graphql.resolve(
query := query,
variables := coalesce(variables, '{}'),
"operationName" := "operationName",
extensions := extensions
);
$$;


Expand Down
299 changes: 172 additions & 127 deletions pg_graphql--0.1.5.sql → pg_graphql--0.2.0.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pg_graphql.control
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
comment = 'GraphQL support'
default_version = '0.1.5'
default_version = '0.2.0'
relocatable = false
1 change: 1 addition & 0 deletions src/sql/reflection/rebuild_schema.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
create or replace function graphql.rebuild_schema()
returns void
security definer
language plpgsql
as $$
begin
Expand Down
304 changes: 174 additions & 130 deletions src/sql/resolve/resolve.sql

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions test/expected/aliases.out
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ begin;
}, +
"tc": 1 +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand All @@ -74,9 +72,9 @@ begin;
}
}
$$);
resolve
------------------------------------------------------
{"data": {"s": {"q": {"n": "Query"}}}, "errors": []}
resolve
----------------------------------------
{"data": {"s": {"q": {"n": "Query"}}}}
(1 row)

rollback;
26 changes: 11 additions & 15 deletions test/expected/allow_camel_names.out
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ begin;
"hasPreviousPage": false +
} +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down Expand Up @@ -113,9 +111,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand All @@ -135,9 +131,9 @@ begin;
}
}
$$);
resolve
-----------------------------------------------------------------------------------------------------------------------------
{"data": {"insertIntoAccountHolderCollection": {"records": [{"someId": 3, "accountHolder": {"someId": 2}}]}}, "errors": []}
resolve
---------------------------------------------------------------------------------------------------------------
{"data": {"insertIntoAccountHolderCollection": {"records": [{"someId": 3, "accountHolder": {"someId": 2}}]}}}
(1 row)

-- Update
Expand All @@ -157,9 +153,9 @@ begin;
}
}
$$);
resolve
---------------------------------------------------------------------------------------------------------------------------------------------
{"data": {"updateAccountHolderCollection": {"records": [{"someId": 3, "accountHolder": {"someId": 3}}], "affectedCount": 1}}, "errors": []}
resolve
-------------------------------------------------------------------------------------------------------------------------------
{"data": {"updateAccountHolderCollection": {"records": [{"someId": 3, "accountHolder": {"someId": 3}}], "affectedCount": 1}}}
(1 row)

-- Delete
Expand All @@ -178,9 +174,9 @@ begin;
}
}
$$);
resolve
-------------------------------------------------------------------------------------------------------------------------------------------------
{"data": {"deleteFromAccountHolderCollection": {"records": [{"someId": 3, "accountHolder": {"someId": 3}}], "affectedCount": 1}}, "errors": []}
resolve
-----------------------------------------------------------------------------------------------------------------------------------
{"data": {"deleteFromAccountHolderCollection": {"records": [{"someId": 3, "accountHolder": {"someId": 3}}], "affectedCount": 1}}}
(1 row)

rollback;
18 changes: 9 additions & 9 deletions test/expected/bigint_is_string.out
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ begin;
}
}
$$);
resolve
---------------------------------------------------------------------------------------------------------------------------
{"data": {"insertIntoBlogPostCollection": {"records": [{"id": "1", "parentId": "1"}], "affectedCount": 1}}, "errors": []}
resolve
-------------------------------------------------------------------------------------------------------------
{"data": {"insertIntoBlogPostCollection": {"records": [{"id": "1", "parentId": "1"}], "affectedCount": 1}}}
(1 row)

select graphql.resolve($$
Expand All @@ -37,9 +37,9 @@ begin;
}
}
$$);
resolve
-----------------------------------------------------------------------------------------------------------------------
{"data": {"updateBlogPostCollection": {"records": [{"id": "1", "parentId": "1"}], "affectedCount": 1}}, "errors": []}
resolve
---------------------------------------------------------------------------------------------------------
{"data": {"updateBlogPostCollection": {"records": [{"id": "1", "parentId": "1"}], "affectedCount": 1}}}
(1 row)

select graphql.resolve($$
Expand All @@ -59,9 +59,9 @@ begin;
}
}
$$);
resolve
--------------------------------------------------------------------------------------------------------------------------------------------------------------
{"data": {"blogPostCollection": {"edges": [{"node": {"id": "1", "parent": {"id": "1", "parentId": "1"}, "parentId": "1"}}], "totalCount": 1}}, "errors": []}
resolve
------------------------------------------------------------------------------------------------------------------------------------------------
{"data": {"blogPostCollection": {"edges": [{"node": {"id": "1", "parent": {"id": "1", "parentId": "1"}, "parentId": "1"}}], "totalCount": 1}}}
(1 row)

rollback;
4 changes: 1 addition & 3 deletions test/expected/empty_mutations.out
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ begin;
}, +
"mutationType": null+
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down
4 changes: 1 addition & 3 deletions test/expected/extend_type_with_function.out
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down
4 changes: 1 addition & 3 deletions test/expected/extend_type_with_generated_column.out
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down
8 changes: 2 additions & 6 deletions test/expected/heartbeat.out
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down Expand Up @@ -62,9 +60,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down
4 changes: 1 addition & 3 deletions test/expected/max_page_size.out
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

36 changes: 19 additions & 17 deletions test/expected/multiple_mutations.out
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ begin;
], +
"affectedCount": 1 +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down Expand Up @@ -87,13 +85,15 @@ begin;
}
}
$$));
jsonb_pretty
--------------------------------------
{ +
"data": null, +
"errors": [ +
"Unknown field 'invalidKey'"+
] +
jsonb_pretty
-----------------------------------------------------
{ +
"data": null, +
"errors": [ +
{ +
"message": "Unknown field 'invalidKey'"+
} +
] +
}
(1 row)

Expand Down Expand Up @@ -125,13 +125,15 @@ begin;
}
}
$$));
jsonb_pretty
--------------------------------------
{ +
"data": null, +
"errors": [ +
"Unknown field 'invalidKey'"+
] +
jsonb_pretty
-----------------------------------------------------
{ +
"data": null, +
"errors": [ +
{ +
"message": "Unknown field 'invalidKey'"+
} +
] +
}
(1 row)

Expand Down
4 changes: 1 addition & 3 deletions test/expected/multiple_queries.out
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down
22 changes: 7 additions & 15 deletions test/expected/mutation_delete.out
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ begin;
}
}
$$);
resolve
---------------------------------------------------------------
{"data": null, "errors": ["delete impacts too many records"]}
resolve
----------------------------------------------------------------------------
{"data": null, "errors": [{"message": "delete impacts too many records"}]}
(1 row)

rollback to savepoint a;
Expand Down Expand Up @@ -116,9 +116,7 @@ begin;
], +
"affectedCount": 1 +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down Expand Up @@ -148,9 +146,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down Expand Up @@ -178,9 +174,7 @@ begin;
"records": [+
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down Expand Up @@ -220,9 +214,7 @@ begin;
} +
] +
} +
}, +
"errors": [ +
] +
} +
}
(1 row)

Expand Down
Loading