Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Issue/604 #717

Merged
merged 6 commits into from
May 7, 2024
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