Skip to content

Commit

Permalink
fix: Issue/604 (#717)
Browse files Browse the repository at this point in the history
* fix: Issue/604

* docs: update CHANGELOG.md

* chore: revert line

* fix: code style

* fix: code style

* docs: Update CHANGELOG.md

---------

Co-authored-by: Jakub Bednář <jakub.bednar@gmail.com>
  • Loading branch information
KYankee6 and bednar committed May 7, 2024
1 parent 5effaa4 commit 61c4500
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
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

0 comments on commit 61c4500

Please sign in to comment.