Skip to content

Commit 08293bc

Browse files
authored
Merge pull request #366 from supabase/or/remove-not-in-pending-not
Removes nin filter pending addition of generic NOT, bump to 1.2.1
2 parents 06f9136 + beb2379 commit 08293bc

File tree

10 files changed

+11
-256
lines changed

10 files changed

+11
-256
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
package_name:
4141
- pg-graphql
4242
pgrx_version:
43-
- 0.8.3
43+
- 0.9.5
4444
postgres: [14, 15]
4545
box:
4646
- { runner: ubuntu-20.04, arch: amd64 }

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pg_graphql"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
55

66
[lib]
@@ -13,7 +13,7 @@ pg15 = ["pgrx/pg15", "pgrx-tests/pg15"]
1313
pg_test = []
1414

1515
[dependencies]
16-
pgrx = "=0.8.3"
16+
pgrx = "=0.9.5"
1717
graphql-parser = "0.4"
1818
serde = { version = "1.0", features = ["rc"] }
1919
serde_json = "1.0"
@@ -26,7 +26,7 @@ base64 = "0.13"
2626
lazy_static = "1"
2727

2828
[dev-dependencies]
29-
pgrx-tests = "=0.8.3"
29+
pgrx-tests = "=0.9.5"
3030

3131
[profile.dev]
3232
panic = "unwind"

dockerfiles/db/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN \
2727
cargo --version
2828

2929
# PGX
30-
RUN cargo install cargo-pgrx --version 0.8.3 --locked
30+
RUN cargo install cargo-pgrx --version 0.9.5 --locked
3131

3232
RUN cargo pgrx init --pg15 $(which pg_config)
3333

docs/api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ The following list shows the operators that may be available on `<Type>Filter` t
510510
| gt | Greater Than |
511511
| gte | Greater Than Or Equal To |
512512
| in | Contained by Value List |
513-
| nin | Not Contained by Value List |
514513
| lt | Less Than |
515514
| lte | Less Than Or Equal To |
516515
| is | Null or Not Null |

docs/changelog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
- bugfix: PostgreSQL type modifiers, e.g. char(n), no longer truncate excess text
2323
- bugfix: Creating a new enum variant between existing variants no longer errors
2424

25-
## master
25+
## 1.2.1
2626
- feature: `String` type filters support `regex`, `iregex`
2727
- feature: computed relationships via functions returning setof
28+
- bugfix: function based computed columns with same name no longer error
29+
30+
## master

src/graphql.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,6 @@ pub enum FilterOp {
29892989
GreaterThan,
29902990
GreaterThanEqualTo,
29912991
In,
2992-
NotIn,
29932992
Is,
29942993
StartsWith,
29952994
Like,
@@ -3008,7 +3007,6 @@ impl ToString for FilterOp {
30083007
Self::GreaterThan => "gt",
30093008
Self::GreaterThanEqualTo => "gte",
30103009
Self::In => "in",
3011-
Self::NotIn => "nin",
30123010
Self::Is => "is",
30133011
Self::StartsWith => "startsWith",
30143012
Self::Like => "like",
@@ -3032,7 +3030,6 @@ impl FromStr for FilterOp {
30323030
"gt" => Ok(Self::GreaterThan),
30333031
"gte" => Ok(Self::GreaterThanEqualTo),
30343032
"in" => Ok(Self::In),
3035-
"nin" => Ok(Self::NotIn),
30363033
"is" => Ok(Self::Is),
30373034
"startsWith" => Ok(Self::StartsWith),
30383035
"like" => Ok(Self::Like),
@@ -3082,7 +3079,6 @@ impl ___Type for FilterTypeType {
30823079
FilterOp::Equal,
30833080
FilterOp::NotEqual,
30843081
FilterOp::In,
3085-
FilterOp::NotIn,
30863082
FilterOp::Is,
30873083
]
30883084
}
@@ -3095,7 +3091,6 @@ impl ___Type for FilterTypeType {
30953091
FilterOp::GreaterThan,
30963092
FilterOp::GreaterThanEqualTo,
30973093
FilterOp::In,
3098-
FilterOp::NotIn,
30993094
FilterOp::Is,
31003095
],
31013096
Scalar::Float => vec![
@@ -3106,7 +3101,6 @@ impl ___Type for FilterTypeType {
31063101
FilterOp::GreaterThan,
31073102
FilterOp::GreaterThanEqualTo,
31083103
FilterOp::In,
3109-
FilterOp::NotIn,
31103104
FilterOp::Is,
31113105
],
31123106
Scalar::String(_) => vec![
@@ -3117,7 +3111,6 @@ impl ___Type for FilterTypeType {
31173111
FilterOp::GreaterThan,
31183112
FilterOp::GreaterThanEqualTo,
31193113
FilterOp::In,
3120-
FilterOp::NotIn,
31213114
FilterOp::Is,
31223115
FilterOp::StartsWith,
31233116
FilterOp::Like,
@@ -3133,7 +3126,6 @@ impl ___Type for FilterTypeType {
31333126
FilterOp::GreaterThan,
31343127
FilterOp::GreaterThanEqualTo,
31353128
FilterOp::In,
3136-
FilterOp::NotIn,
31373129
FilterOp::Is,
31383130
],
31393131
Scalar::Date => vec![
@@ -3144,7 +3136,6 @@ impl ___Type for FilterTypeType {
31443136
FilterOp::GreaterThan,
31453137
FilterOp::GreaterThanEqualTo,
31463138
FilterOp::In,
3147-
FilterOp::NotIn,
31483139
FilterOp::Is,
31493140
],
31503141
Scalar::Time => vec![
@@ -3155,7 +3146,6 @@ impl ___Type for FilterTypeType {
31553146
FilterOp::GreaterThan,
31563147
FilterOp::GreaterThanEqualTo,
31573148
FilterOp::In,
3158-
FilterOp::NotIn,
31593149
FilterOp::Is,
31603150
],
31613151
Scalar::Datetime => vec![
@@ -3166,7 +3156,6 @@ impl ___Type for FilterTypeType {
31663156
FilterOp::GreaterThan,
31673157
FilterOp::GreaterThanEqualTo,
31683158
FilterOp::In,
3169-
FilterOp::NotIn,
31703159
FilterOp::Is,
31713160
],
31723161
Scalar::BigFloat => vec![
@@ -3177,7 +3166,6 @@ impl ___Type for FilterTypeType {
31773166
FilterOp::GreaterThan,
31783167
FilterOp::GreaterThanEqualTo,
31793168
FilterOp::In,
3180-
FilterOp::NotIn,
31813169
FilterOp::Is,
31823170
],
31833171
Scalar::Opaque => vec![FilterOp::Equal, FilterOp::Is],
@@ -3205,7 +3193,7 @@ impl ___Type for FilterTypeType {
32053193
default_value: None,
32063194
sql_type: None,
32073195
},
3208-
FilterOp::In | FilterOp::NotIn => __InputValue {
3196+
FilterOp::In => __InputValue {
32093197
name_: op.to_string(),
32103198
type_: __Type::List(ListType {
32113199
type_: Box::new(__Type::NonNull(NonNullType {

src/transpile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ impl FilterBuilderElem {
654654
}
655655
_ => {
656656
let cast_type_name = match op {
657-
FilterOp::In | FilterOp::NotIn => format!("{}[]", column.type_name),
657+
FilterOp::In => format!("{}[]", column.type_name),
658658
_ => column.type_name.clone(),
659659
};
660660

@@ -671,7 +671,6 @@ impl FilterBuilderElem {
671671
FilterOp::GreaterThan => ">",
672672
FilterOp::GreaterThanEqualTo => ">=",
673673
FilterOp::In => "= any",
674-
FilterOp::NotIn => "<> all",
675674
FilterOp::StartsWith => "^@",
676675
FilterOp::Like => "like",
677676
FilterOp::ILike => "ilike",

test/expected/resolve_connection_filter.out

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,6 @@ begin;
254254
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 2}}]}}}
255255
(1 row)
256256

257-
rollback to savepoint a;
258-
-- nin - int
259-
select graphql.resolve($${accountCollection(filter: {id: {nin: [1, 2]}}) { edges { node { id } } }}$$);
260-
resolve
261-
-------------------------------------------------------------------
262-
{"data": {"accountCollection": {"edges": [{"node": {"id": 3}}]}}}
263-
(1 row)
264-
265257
rollback to savepoint a;
266258
-- in - int coerce to list
267259
select graphql.resolve($${accountCollection(filter: {id: {in: 2}}) { edges { node { id } } }}$$);
@@ -270,14 +262,6 @@ begin;
270262
{"data": {"accountCollection": {"edges": [{"node": {"id": 2}}]}}}
271263
(1 row)
272264

273-
rollback to savepoint a;
274-
-- nin - int coerce to list
275-
select graphql.resolve($${accountCollection(filter: {id: {nin: 2}}) { edges { node { id } } }}$$);
276-
resolve
277-
----------------------------------------------------------------------------------------
278-
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 3}}]}}}
279-
(1 row)
280-
281265
rollback to savepoint a;
282266
-- in - text
283267
select graphql.resolve($${accountCollection(filter: {name: {in: ["foo", "bar"]}}) { edges { node { id } } }}$$);
@@ -286,14 +270,6 @@ begin;
286270
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 2}}]}}}
287271
(1 row)
288272

289-
rollback to savepoint a;
290-
-- nin - text
291-
select graphql.resolve($${accountCollection(filter: {name: {nin: ["foo", "bar"]}}) { edges { node { id } } }}$$);
292-
resolve
293-
-------------------------------------------------------------------
294-
{"data": {"accountCollection": {"edges": [{"node": {"id": 3}}]}}}
295-
(1 row)
296-
297273
rollback to savepoint a;
298274
-- in - text coerce to list
299275
select graphql.resolve($${accountCollection(filter: {name: {in: "baz"}}) { edges { node { id } } }}$$);
@@ -302,14 +278,6 @@ begin;
302278
{"data": {"accountCollection": {"edges": [{"node": {"id": 3}}]}}}
303279
(1 row)
304280

305-
rollback to savepoint a;
306-
-- nin - text coerce to list
307-
select graphql.resolve($${accountCollection(filter: {name: {nin: "baz"}}) { edges { node { id } } }}$$);
308-
resolve
309-
----------------------------------------------------------------------------------------
310-
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 2}}]}}}
311-
(1 row)
312-
313281
rollback to savepoint a;
314282
-- in - empty list
315283
select graphql.resolve($${accountCollection(filter: {name: {in: []}}) { edges { node { id } } }}$$);
@@ -318,14 +286,6 @@ begin;
318286
{"data": {"accountCollection": {"edges": []}}}
319287
(1 row)
320288

321-
rollback to savepoint a;
322-
-- nin - empty list
323-
select graphql.resolve($${accountCollection(filter: {name: {nin: []}}) { edges { node { id } } }}$$);
324-
resolve
325-
-------------------------------------------------------------------------------------------------------------
326-
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 2}}, {"node": {"id": 3}}]}}}
327-
(1 row)
328-
329289
rollback to savepoint a;
330290
-- in - null literal returns nothing
331291
select graphql.resolve($${accountCollection(filter: {name: {in: null}}) { edges { node { id } } }}$$);
@@ -334,14 +294,6 @@ begin;
334294
{"data": {"accountCollection": {"edges": []}}}
335295
(1 row)
336296

337-
rollback to savepoint a;
338-
-- nin - null literal returns nothing
339-
select graphql.resolve($${accountCollection(filter: {name: {nin: null}}) { edges { node { id } } }}$$);
340-
resolve
341-
------------------------------------------------
342-
{"data": {"accountCollection": {"edges": []}}}
343-
(1 row)
344-
345297
rollback to savepoint a;
346298
-- variable in - absent treated as ignored / returns all
347299
select graphql.resolve($$query AAA($nin: [String!]) { accountCollection(filter: {name: {in: $nin}}) { edges { node { id } } }}$$, '{}');

0 commit comments

Comments
 (0)