Skip to content

Commit

Permalink
feat: added to function without org parameter (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar authored Nov 11, 2020
1 parent 69544f5 commit b514de5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
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

0 comments on commit b514de5

Please sign in to comment.