Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
1. [#684](https://github.com/influxdata/influxdb-client-java/issues/684): Fix checking for CSV end of table marker when parsing CSV stream to InfluxQLQueryResult, needed for example when parsing the results of a query like "SHOW SERIES".
2. [#662](https://github.com/influxdata/influxdb-client-java/issues/662): Adds to FluxDsl support for the `|> elapsed(unit)` function.
3. [#623](https://github.com/influxdata/influxdb-client-java/issues/623): Enables the use of IPv6 addresses.
4. [#604](https://github.com/influxdata/influxdb-client-java/issues/604): Custom FluxDSL restrictions for regular expressions

### Dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ public String toString() {

String value;
if (fieldValue instanceof String) {
value = "\"" + escapeDoubleQuotes((String) fieldValue) + "\"";
if (operator.contains("~")) {
value = escapeDoubleQuotes((String) fieldValue);
} else {
value = "\"" + escapeDoubleQuotes((String) fieldValue) + "\"";
}
} else {
value = FunctionsParameters.serializeValue(fieldValue, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ void contains() {
Assertions.assertThat(restrictions.toString()).isEqualTo("contains(value: r[\"_value\"], set:[\"value1\", \"value2\"])");
}

@Test
void custom (){
Restrictions restrictions = Restrictions.value().custom("/.*target.*/", "=~");

Assertions.assertThat(restrictions.toString()).isEqualTo("r[\"_value\"] =~ /.*target.*/");

restrictions = Restrictions.value().custom("1", "==");

Assertions.assertThat(restrictions.toString()).isEqualTo("r[\"_value\"] == \"1\"");
}

@Test
void not() {

Expand Down