Skip to content

Instantly share code, notes, and snippets.

View vietj's full-sized avatar
🤖
Coding the Future

Julien Viet vietj

🤖
Coding the Future
View GitHub Profile
client.request(HttpMethod.GET, server.actualPort(), "localhost", "/")
.onComplete(testContext.succeeding(req -> {
req.onComplete(testContext.succeeding(httpClientResponse -> {
testContext.verify(() -> {
assertThat(httpClientResponse.statusCode())
.isEqualTo(200);
});
checkpoint.flag();
}));
try {
public class FrancescoTest {
private static final HttpClient client = null;
public static void main(String[] args) {
MessageFactory factory = new MessageFactory(builder -> {
builder.writeBinary(new CloudEvent() {
});
});
private Single<List<String>> inTransaction(Exception e) throws Exception {
return client.rxGetConnection().flatMap(conn -> {
return rxInsertExtraFolks(conn)
.andThen(uniqueNames(conn))
.<List<String>>collect(ArrayList::new, List::add)
.compose(upstream -> e == null ? upstream : upstream.flatMap(names -> Single.error(e)))
.compose(SQLClientHelper.txSingleTransformer(conn))
.flatMap(names -> rxAssertAutoCommit(conn).andThen(Single.just(names)))

Reactive PostgreSQL Client

The Reactive PostgreSQL Client is a client for PostgreSQL with a straightforward API focusing on scalability and low overhead.

The client is reactive and non blocking, allowing to handle many database connections with a single thread.

  • Event driven

  • Lightweight

SQL Client Templates

Table of Contents

SQL Client Templates is a small library designed to facilitate the execution of SQL queries.

Usage

To use SQL Client Templates add the following dependency to the dependencies section of your build descriptor:

  • Maven (in your pom.xml):

@Test
public void testResolveAbsoluteFile() throws Exception {
File folder = File.createTempFile("test", ".txt");
assertTrue(folder.delete());
assertTrue(folder.mkdirs());
folder.deleteOnExit(); // Cleanup
File f = new File(folder, "child.txt");
Files.write(f.toPath(), "the_child".getBytes());
File notFound = new File(folder, "not_found");
Thread thread = Thread.currentThread();
pool.begin(res -> {
if (res.succeeded()) {
// Get the transaction
Transaction tx = res.result();
// Various statements
tx.query("INSERT INTO Users (first_name,last_name) VALUES ('Julien','Viet')")
.execute(ar1 -> {
if (ar1.succeeded()) {
@VertxGen
public interface SqlTemplate<R> {
static SqlTemplate<RowSet<Row>> forQuery(SqlClient client, String template) {
Collector<Row, ?, SqlResult<Row>> collector = null;
Function<SqlResult<Row>, RowSet<Row>> bilto = null;
return new SqlTemplateImpl<SqlResult<Row>, RowSet<Row>>(client, collector, bilto, template);
}
public void customKeyManagerFactory() {
Vertx vertx = Vertx.vertx();
vertx.createHttpServer(new HttpServerOptions().setKeyCertOptions(new KeyCertOptions() {
@Override
public KeyManagerFactory getKeyManagerFactory(Vertx vertx) throws Exception {
throw new UnsupportedOperationException("Implement me");
}
@Override
public KeyCertOptions clone() {
throw new UnsupportedOperationException("Implement me");
public class JDBCTxOp extends AbstractJDBCAction<Void> {
private final TxCommand op;
public JDBCTxOp(JDBCStatementHelper helper, TxCommand op, SQLOptions options) {
super(helper, options);
this.op = op;
}
@Override