Skip to content

Commit 854f21f

Browse files
authored
feat(flux-dsl): supports not operator (#334)
1 parent 115a075 commit 854f21f

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
- see [What is different in RxJava3](https://github.com/ReactiveX/RxJava/wiki/What's-different-in-3.0)
88

9-
109
### Changes in public API
1110

1211
- `WriteService` imports:
@@ -66,7 +65,8 @@ This release also uses new version of InfluxDB OSS API definitions - [oss.yml](h
6665
1. [#289](https://github.com/influxdata/influxdb-client-java/pull/298): Upgrade `RxJava2` -> `RxJava3`, update outdated dependencies
6766
1. [#316](https://github.com/influxdata/influxdb-client-java/pull/316): Add `InvocableScriptsApi` to create, update, list, delete and invoke scripts by seamless way
6867
1. [#315](https://github.com/influxdata/influxdb-client-java/pull/315): Add support for timezones [FluxDSL]
69-
1. [#317](https://github.com/influxdata/influxdb-client-java/pull/317): Gets HTTP headers from the unsuccessful HTTP reques
68+
1. [#317](https://github.com/influxdata/influxdb-client-java/pull/317): Gets HTTP headers from the unsuccessful HTTP request
69+
1. [#334](https://github.com/influxdata/influxdb-client-java/pull/334): Supports not operator [FluxDSL]
7070

7171
### Bug Fixes
7272
1. [#313](https://github.com/influxdata/influxdb-client-java/pull/313): Do not deliver `exception` when the consumer is already disposed [influxdb-client-reactive]

flux-dsl/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ Supported Record columns:
240240

241241
Supported Record restrictions:
242242
- `equal`
243+
- `not`
243244
- `notEqual`
244245
- `less`
245246
- `greater`

flux-dsl/src/main/java/com/influxdb/query/dsl/functions/restriction/Restrictions.java

+20
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public static Restrictions or(@Nonnull final Restrictions... restrictions) {
4343
return new Logical("or", restrictions);
4444
}
4545

46+
@Nonnull
47+
public static Restrictions not(@Nonnull final Restrictions restrictions) {
48+
return new Not(restrictions);
49+
}
50+
4651
/**
4752
* Create Record measurement restriction.
4853
*
@@ -149,4 +154,19 @@ public String toString() {
149154
.toString();
150155
}
151156
}
157+
158+
private static class Not extends Restrictions {
159+
160+
private final Restrictions restriction;
161+
162+
Not(@Nonnull final Restrictions restrictions) {
163+
super();
164+
this.restriction = restrictions;
165+
}
166+
167+
@Override
168+
public String toString() {
169+
return "not " + restriction.toString();
170+
}
171+
}
152172
}

flux-dsl/src/test/java/com/influxdb/query/dsl/functions/restriction/RestrictionsTest.java

+7
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ void exists() {
6464
Assertions.assertThat(restrictions.toString()).isEqualTo("exists r[\"_value\"]");
6565
}
6666

67+
@Test
68+
void not() {
69+
70+
Restrictions restrictions = Restrictions.not(Restrictions.value().exists());
71+
Assertions.assertThat(restrictions.toString()).isEqualTo("not exists r[\"_value\"]");
72+
}
73+
6774
@Test
6875
void emptyLogical() {
6976

0 commit comments

Comments
 (0)