io.vertx.mutiny.sqlclient.Row Java Examples

The following examples show how to use io.vertx.mutiny.sqlclient.Row. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Fruit.java    From quarkus-quickstarts with Apache License 2.0 5 votes vote down vote up
public static Uni<List<Fruit>> findAll(PgPool client) {
    return client.query("SELECT id, name FROM fruits ORDER BY name ASC").execute()
            .onItem().apply(pgRowSet -> {
                List<Fruit> list = new ArrayList<>(pgRowSet.size());
                for (Row row : pgRowSet) {
                    list.add(from(row));
                }
                return list;
            });
}
 
Example #2
Source File: FruitResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@GET
@Produces(MediaType.APPLICATION_JSON)
public CompletionStage<JsonArray> listFruits() {
    return client.query("SELECT * FROM fruits").execute()
            .map(mysqlRowSet -> {
                JsonArray jsonArray = new JsonArray();
                for (Row row : mysqlRowSet) {
                    jsonArray.add(toJson(row));
                }
                return jsonArray;
            })
            .subscribeAsCompletionStage();
}
 
Example #3
Source File: FruitResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@GET
@Produces(MediaType.APPLICATION_JSON)
public CompletionStage<JsonArray> listFruits() {
    return client.query("SELECT * FROM fruits").execute()
            .map(mysqlRowSet -> {
                JsonArray jsonArray = new JsonArray();
                for (Row row : mysqlRowSet) {
                    jsonArray.add(toJson(row));
                }
                return jsonArray;
            })
            .subscribeAsCompletionStage();
}
 
Example #4
Source File: FruitResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@GET
@Produces(MediaType.APPLICATION_JSON)
public CompletionStage<JsonArray> listFruits() {
    return client.query("SELECT * FROM fruits").execute()
            .map(pgRowSet -> {
                JsonArray jsonArray = new JsonArray();
                for (Row row : pgRowSet) {
                    jsonArray.add(toJson(row));
                }
                return jsonArray;
            })
            .subscribeAsCompletionStage();
}
 
Example #5
Source File: HotReloadFruitResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@GET
@Produces(MediaType.APPLICATION_JSON)
public CompletionStage<JsonArray> listFruits() {
    return client.query("SELECT * FROM fruits").execute()
            .map(pgRowSet -> {
                JsonArray jsonArray = new JsonArray();
                for (Row row : pgRowSet) {
                    jsonArray.add(toJson(row));
                }
                return jsonArray;
            })
            .subscribeAsCompletionStage();
}
 
Example #6
Source File: FortuneRepository.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Uni<List<Fortune>> findAll() {
    return clients.getClient().preparedQuery("SELECT * FROM Fortune" )
            .execute()
            .map(rowset -> {
                List<Fortune> ret = new ArrayList<>(rowset.size()+1);
                for(Row r : rowset) {
                    ret.add(new Fortune(r.getInteger("id"), r.getString("message")));
                }
                return ret;
            });
}
 
Example #7
Source File: WorldRepository.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Uni<World> find(int id) {
    return clients.getClient().preparedQuery("SELECT id, randomNumber FROM World WHERE id = $1")
            .execute(Tuple.of(id))
            .map(rowset -> {
                Row row = rowset.iterator().next();
                return new World(row.getInteger(0), row.getInteger(1));
            });
}
 
Example #8
Source File: Fruit.java    From quarkus-quickstarts with Apache License 2.0 4 votes vote down vote up
private static Fruit from(Row row) {
    return new Fruit(row.getLong("id"), row.getString("name"));
}
 
Example #9
Source File: Fruit.java    From quarkus-quickstarts with Apache License 2.0 4 votes vote down vote up
private static Fruit from(Row row) {
    return new Fruit(row.getLong("id"), row.getString("name"));
}
 
Example #10
Source File: FruitResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private JsonObject toJson(Row row) {
    return new JsonObject()
            .put("id", row.getLong("id"))
            .put("name", row.getString("name"));
}
 
Example #11
Source File: HibernateReactiveDB2TestEndpoint.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private Uni<RowSet<Row>> populateDB() {
    return db2Pool.query("DELETE FROM Pig").execute()
            .flatMap(junk -> db2Pool.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
}
 
Example #12
Source File: HibernateReactiveTestEndpoint.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private Uni<RowSet<Row>> populateDB() {
    return pgPool.query("DELETE FROM Pig").execute()
            .flatMap(junk -> pgPool.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
}
 
Example #13
Source File: HibernateReactiveMySQLTestEndpoint.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private Uni<RowSet<Row>> populateDB() {
    return mysqlPool.query("DELETE FROM Pig").execute()
            .flatMap(junk -> mysqlPool.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
}
 
Example #14
Source File: FruitResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private JsonObject toJson(Row row) {
    return new JsonObject()
            .put("id", row.getLong("id"))
            .put("name", row.getString("name"));
}
 
Example #15
Source File: FruitResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private JsonObject toJson(Row row) {
    return new JsonObject()
            .put("id", row.getLong("id"))
            .put("name", row.getString("name"));
}
 
Example #16
Source File: HotReloadFruitResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private JsonObject toJson(Row row) {
    return new JsonObject()
            .put("id", row.getLong("id"))
            .put("name", row.getString("name"));
}