Skip to content

Commit

Permalink
remove nregex and niregex
Browse files Browse the repository at this point in the history
  • Loading branch information
olirice committed Apr 25, 2023
1 parent e29f4e7 commit 759360a
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 139 deletions.
34 changes: 15 additions & 19 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@ Where the `<Table>Filter` type enumerates filterable fields and their associated
ilike: String
regex: String
iregex: String
nregex: String
niregex: String
}
```

Expand All @@ -505,23 +503,21 @@ Where the `<Table>Filter` type enumerates filterable fields and their associated
The following list shows the operators that may be available on `<Type>Filter` types.


| Operator | Description |
| ----------- | ------------------------- |
| eq | Equal To |
| neq | Not Equal To |
| gt | Greater Than |
| gte | Greater Than Or Equal To |
| in | Contained by Value List |
| lt | Less Than |
| lte | Less Than Or Equal To |
| is | Null or Not Null |
| startsWith | `String` starts with prefix |
| like | Case Sensitive `String` Pattern Match. '%' as wildcard |
| ilike | Case Insensitive `String` Pattern Match. '%' as wildcard |
| regex | Case Sensitive `String` Regular Expression Match |
| iregex | Case Insensitive `String` Regular Expression Match |
| nregex | Case Sensitive `String` Regular Expression Negative Match |
| niregex | Case Insensitive `String` Regular Expression Negative Match |
| Operator | Description |
| ----------- | -------------------------------------------------|
| eq | Equal To |
| neq | Not Equal To |
| gt | Greater Than |
| gte | Greater Than Or Equal To |
| in | Contained by Value List |
| lt | Less Than |
| lte | Less Than Or Equal To |
| is | Null or Not Null |
| startsWith | Starts with prefix |
| like | Pattern Match. '%' as wildcard |
| ilike | Pattern Match. '%' as wildcard. Case Insensitive |
| regex | POSIX Regular Expression Match |
| iregex | POSIX Regular Expression Match. Case Insensitive |

Not all operators are available on every `<Type>Filter` type. For example, `UUIDFilter` only supports `eq` and `neq` because `UUID`s are not ordered.

Expand Down
2 changes: 2 additions & 0 deletions docs/assets/demo_schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ input StringFilter {
startsWith: String
like: String
ilike: String
regex: String
iregex: String
}

scalar Time
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
- bugfix: Unknown types are represented in GraphQL schema as `Opaque` rather than `String`
- bugfix: PostgreSQL type modifiers, e.g. char(n), no longer truncate excess text
- bugfix: Creating a new enum variant between existing variants no longer errors

## master
- feature: `String` type filters support `regex`, `iregex`
12 changes: 1 addition & 11 deletions src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3013,8 +3013,6 @@ pub enum FilterOp {
ILike,
RegEx,
IRegEx,
NotRegEx,
NotIRegEx
}

impl ToString for FilterOp {
Expand All @@ -3034,8 +3032,6 @@ impl ToString for FilterOp {
Self::ILike => "ilike",
Self::RegEx => "regex",
Self::IRegEx => "iregex",
Self::NotRegEx => "nregex",
Self::NotIRegEx => "niregex",
}
.to_string()
}
Expand All @@ -3060,8 +3056,6 @@ impl FromStr for FilterOp {
"ilike" => Ok(Self::ILike),
"regex" => Ok(Self::RegEx),
"iregex" => Ok(Self::IRegEx),
"nregex" => Ok(Self::NotRegEx),
"niregex" => Ok(Self::NotIRegEx),
_ => Err("Invalid filter operation".to_string()),
}
}
Expand Down Expand Up @@ -3147,8 +3141,6 @@ impl ___Type for FilterTypeType {
FilterOp::ILike,
FilterOp::RegEx,
FilterOp::IRegEx,
FilterOp::NotRegEx,
FilterOp::NotIRegEx
],
Scalar::BigInt => vec![
FilterOp::Equal,
Expand Down Expand Up @@ -3223,9 +3215,7 @@ impl ___Type for FilterTypeType {
| FilterOp::Like
| FilterOp::ILike
| FilterOp::RegEx
| FilterOp::IRegEx
| FilterOp::NotRegEx
| FilterOp::NotIRegEx => __InputValue {
| FilterOp::IRegEx => __InputValue {
name_: op.to_string(),
type_: __Type::Scalar(scalar.clone()),
description: None,
Expand Down
2 changes: 0 additions & 2 deletions src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,6 @@ impl FilterBuilderElem {
FilterOp::ILike => "ilike",
FilterOp::RegEx => "~",
FilterOp::IRegEx => "~*",
FilterOp::NotRegEx => "!~",
FilterOp::NotIRegEx => "!~*",
FilterOp::Is => {
return Err("Error transpiling Is filter".to_string());
}
Expand Down
Loading

0 comments on commit 759360a

Please sign in to comment.