Quarkus Reactive PostgreSQL Vert.x - 无法解析 'Query' 中的方法 'thenCompose'
Quarkus Reactive PostgreSQL Vert.x - Cannot resolve method 'thenCompose' in 'Query'
无论导入什么依赖项,我都会遇到这个问题。我遵循了 https://quarkus.io/guides/reactive-postgres-client 中的指南。使用另一个依赖项——例如,不是“通过”Quarkus——也不能解决它。它在这段代码中:
private void initDatabase() {
client.query("DROP TABLE IF EXISTS fruits")
.thenCompose(r -> client.query("CREATE TABLE fruits (id SERIAL PRIMARY KEY, name TEXT NOT NULL)"))
.thenCompose(r -> client.query("INSERT INTO fruits (name) VALUES ('Orange')"))
.thenCompose(r -> client.query("INSERT INTO fruits (name) VALUES ('Pear')"))
.thenCompose(r -> client.query("INSERT INTO fruits (name) VALUES ('Apple')"))
.toCompletableFuture()
.join();
}
此页面不再有效,我不确定为什么它没有从网站上删除。这是更新的:https://quarkus.io/guides/reactive-sql-clients
在大多数情况下,对于 Quarkus,您应该使用 io.vertx.mutiny.pgclient.PgPool
。
方法实现为:
private void initdb() {
client.query("DROP TABLE IF EXISTS fruits").execute()
.flatMap(r -> client.query("CREATE TABLE fruits (id SERIAL PRIMARY KEY, name TEXT NOT NULL)").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Kiwi')").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Durian')").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Pomelo')").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Lychee')").execute())
.await().indefinitely();
}
无论导入什么依赖项,我都会遇到这个问题。我遵循了 https://quarkus.io/guides/reactive-postgres-client 中的指南。使用另一个依赖项——例如,不是“通过”Quarkus——也不能解决它。它在这段代码中:
private void initDatabase() {
client.query("DROP TABLE IF EXISTS fruits")
.thenCompose(r -> client.query("CREATE TABLE fruits (id SERIAL PRIMARY KEY, name TEXT NOT NULL)"))
.thenCompose(r -> client.query("INSERT INTO fruits (name) VALUES ('Orange')"))
.thenCompose(r -> client.query("INSERT INTO fruits (name) VALUES ('Pear')"))
.thenCompose(r -> client.query("INSERT INTO fruits (name) VALUES ('Apple')"))
.toCompletableFuture()
.join();
}
此页面不再有效,我不确定为什么它没有从网站上删除。这是更新的:https://quarkus.io/guides/reactive-sql-clients
在大多数情况下,对于 Quarkus,您应该使用 io.vertx.mutiny.pgclient.PgPool
。
方法实现为:
private void initdb() {
client.query("DROP TABLE IF EXISTS fruits").execute()
.flatMap(r -> client.query("CREATE TABLE fruits (id SERIAL PRIMARY KEY, name TEXT NOT NULL)").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Kiwi')").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Durian')").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Pomelo')").execute())
.flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Lychee')").execute())
.await().indefinitely();
}