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

feat: added to function without org parameter #172

Merged
merged 2 commits into from
Nov 11, 2020
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 1.14.0 [unreleased]

### Features
1. [#172](https://github.com/influxdata/influxdb-client-java/pull/172): flux-dsl: added `to` function without `org` parameter

## 1.13.0 [2020-10-30]

### Features
Expand Down
13 changes: 13 additions & 0 deletions flux-dsl/src/main/java/com/influxdb/query/dsl/Flux.java
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,19 @@ public final ToFlux to() {
return new ToFlux(this);
}

/**
* To operation takes data from a stream and writes it to a bucket.
*
* @param bucket The bucket to which data will be written.
* @return {@link ToFlux}
*/
@Nonnull
public final ToFlux to(@Nonnull final String bucket) {

return new ToFlux(this)
.withBucket(bucket);
}

/**
* To operation takes data from a stream and writes it to a bucket.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@
* <li><b>fieldFn</b> - Function that takes a record from the input table and returns an object.</li>
* </ul>
*
* <h3>Example</h3>
* <h3>Examples</h3>
* <pre>
* Flux flux = Flux
* .from("telegraf")
* .to("my-bucket");
* </pre>
* <pre>
* Flux flux = Flux
* .from("telegraf")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ void to() {
Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace(expected);
}

@Test
void toBucket() {

Flux flux = Flux
.from("telegraf")
.to("my-bucket");

Assertions.assertThat(flux.toString())
.isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> to(bucket: \"my-bucket\")");
}

@Test
void toBucketOrg() {

Expand Down