beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wardva <...@git.apache.org>
Subject [GitHub] beam pull request #3934: Add @FunctionalInterface annotation to several inte...
Date Tue, 03 Oct 2017 13:53:19 GMT
GitHub user wardva opened a pull request:

    https://github.com/apache/beam/pull/3934

    Add @FunctionalInterface annotation to several interfaces

    By adding the `@FunctionalInterface` to `RowMapper`, `StatementPreperator` and
    `PreparedStatementSetter` it's possible to write a JdbcIO source in a
    more concise and functional style:
    ```
    pipeline.apply(JdbcIO.<KV<Integer, String>>read()
      .withQuery("select id,name from Person where name = ?")
      .withRowMapper(resultSet -> KV.of(resultSet.getInt(1), resultSet.getString(2)))
      .withStatementPreparator(preparedStatement -> preparedStatement.setString(1, "Darwin"))
    );
    ```
    
    This change is backwards compatible with existing `JdbcIO` sources.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/wardva/beam jdbcio-functional-interfaces

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/beam/pull/3934.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3934
    
----
commit 31167cf50c4b6c61e45f149f2f42efb8e22355e8
Author: Ward Van Assche <ward@piesync.com>
Date:   2017-10-03T13:13:22Z

    Add @FunctionalInterface annotation to several interfaces
    
    By adding the @FunctionalInterface to RowMapper, StatementPreperator and
    PreparedStatementSetter it's possible to write a JdbcIO source in a
    more concise and functional style.
    
    This change is backwards compatible with existing JdbcIO sources.

----


---

Mime
View raw message