How to use the @vertx/sql-client/options.PoolOptions function in @vertx/sql-client

To help you get started, we’ve selected a few @vertx/sql-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TechEmpower / FrameworkBenchmarks / frameworks / JavaScript / es4x / index.js View on Github external
.end(JSON.stringify({ message: 'Hello, World!' }));
});

const UPDATE_WORLD = "UPDATE world SET randomnumber=$1 WHERE id=$2";
const SELECT_WORLD = "SELECT id, randomnumber from WORLD where id=$1";
const SELECT_FORTUNE = "SELECT id, message from FORTUNE";

let connectOptions = new PgConnectOptions()
  .setCachePreparedStatements(true)
  .setHost('tfb-database')
  .setUser('benchmarkdbuser')
  .setPassword('benchmarkdbpass')
  .setDatabase('hello_world');

// Pool options
let poolOptions = new PoolOptions()
  .setMaxSize(1);

// Create the client pool
let client = PgPool.pool(vertx, connectOptions, poolOptions);

/*
 * This test exercises the framework's object-relational mapper (ORM), random number generator, database driver,
 * and database connection pool.
 */
app.get("/db").handler(ctx => {
  client.preparedQuery(SELECT_WORLD, Tuple.of(util.randomWorld()), res => {
    if (res.succeeded()) {
      let resultSet = res.result().iterator();

      if (!resultSet.hasNext()) {
        ctx.fail(404);

@vertx/sql-client

Generated Eclipse Vert.x bindings for 'vertx-sql-client'

Apache-2.0
Latest version published 5 months ago

Package Health Score

68 / 100
Full package analysis

Similar packages