package io.vertx.groovy.ext.sql;
public class SQLConnection_GroovyExtension {
  public static io.vertx.ext.sql.SQLOperations querySingle(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Object>>> handler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.querySingle(sql,
      handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray> ar) {
        handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonArray(event)));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLOperations querySingleWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, java.util.List<Object> arguments, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Object>>> handler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.querySingleWithParams(sql,
      arguments != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(arguments) : null,
      handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray> ar) {
        handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonArray(event)));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection setOptions(io.vertx.ext.sql.SQLConnection j_receiver, java.util.Map<String, Object> options) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.setOptions(options != null ? new io.vertx.ext.sql.SQLOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection query(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.query(sql,
      resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet> ar) {
        resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection queryWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, java.util.List<Object> params, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.queryWithParams(sql,
      params != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(params) : null,
      resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet> ar) {
        resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection queryStreamWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, java.util.List<Object> params, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.SQLRowStream>> handler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.queryStreamWithParams(sql,
      params != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(params) : null,
      handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.SQLRowStream>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.SQLRowStream> ar) {
        handler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromObject(event)));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection update(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.update(sql,
      resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.UpdateResult>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.UpdateResult> ar) {
        resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection updateWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, java.util.List<Object> params, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.updateWithParams(sql,
      params != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(params) : null,
      resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.UpdateResult>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.UpdateResult> ar) {
        resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection call(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.call(sql,
      resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet> ar) {
        resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection callWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sql, java.util.List<Object> params, java.util.List<Object> outputs, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.callWithParams(sql,
      params != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(params) : null,
      outputs != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(outputs) : null,
      resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet>>() {
      public void handle(io.vertx.core.AsyncResult<io.vertx.ext.sql.ResultSet> ar) {
        resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection batchWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sqlStatement, java.util.List<java.util.List<Object>> args, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>>> handler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.batchWithParams(sqlStatement,
      args != null ? args.stream().map(elt -> elt != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(elt) : null).collect(java.util.stream.Collectors.toList()) : null,
      handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>>>() {
      public void handle(io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>> ar) {
        handler.handle(ar.map(event -> event != null ? event.stream().map(elt -> elt).collect(java.util.stream.Collectors.toList()) : null));
      }
    } : null));
    return j_receiver;
  }
  public static io.vertx.ext.sql.SQLConnection batchCallableWithParams(io.vertx.ext.sql.SQLConnection j_receiver, java.lang.String sqlStatement, java.util.List<java.util.List<Object>> inArgs, java.util.List<java.util.List<Object>> outArgs, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>>> handler) {
    io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.batchCallableWithParams(sqlStatement,
      inArgs != null ? inArgs.stream().map(elt -> elt != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(elt) : null).collect(java.util.stream.Collectors.toList()) : null,
      outArgs != null ? outArgs.stream().map(elt -> elt != null ? io.vertx.core.impl.ConversionHelper.toJsonArray(elt) : null).collect(java.util.stream.Collectors.toList()) : null,
      handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>>>() {
      public void handle(io.vertx.core.AsyncResult<java.util.List<java.lang.Integer>> ar) {
        handler.handle(ar.map(event -> event != null ? event.stream().map(elt -> elt).collect(java.util.stream.Collectors.toList()) : null));
      }
    } : null));
    return j_receiver;
  }
}