Digest for jooq-user@googlegroups.com - 1 update in 1 topic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digest for jooq-user@googlegroups.com - 1 update in 1 topic

http://groups.google.com/group/jooq-user/topics mailing list
[hidden email]: Aug 31 12:56PM -0700

I'm using Vert.x Jooq <https://github.com/jklingsporn/vertx-jooq> in
Kotlin. I'm wondering if there's a way to use Vert.x Guice
<https://github.com/ef-labs/vertx-guice> to avoid passing the parameters
jooqConfig and dbClient
 
UserDao(jooqConfig, dbClient)
 
and instead simplify it to
 
UserDao()
 
 
This is the text Vert.x handler:
 
private fun jooqRxAsyncHandler(context: RoutingContext) {
val jooqConfig: Configuration = DefaultConfiguration().set(SQLDialect.POSTGRES)
val dbCredentials = JsonObject()
.put("host", "localhost")
.put("username", "username")
.put("password", "password")
.put("database", "dbname")
 
dbClient = PostgreSQLClient.createNonShared(vertx, com.datadeploytool.database.dbCredentials)
 
val dao = UserDao(jooqConfig, dbClient)
println("getting. client: $dbClient")
 
dao.deleteByCondition(USER.EMAIL.eq("[hidden email]")).ignoreElement()
.andThen(
dao.insert(User("[hidden email]",
"[hidden email]",
Timestamp(System.currentTimeMillis()))
).ignoreElement()
.andThen(
dao.findOneByCondition(USER.EMAIL.eq("[hidden email]"))
)
.doOnEvent { something, x ->
if (x == null) {
context.response().putHeader("content-type", "text/html").end("JOOQ test $something")
 
} else {
System.err.println("Something failed badly: " + x.message)
context.response().putHeader("content-type", "text/html").end("JOOQ error")
}
}
.subscribe()
 
println("done")}
 
Here is the generated DAO class:
 
/*
* This file is generated by jOOQ.
*/
package jooq.generated.tables.daos;
 
 
import io.github.jklingsporn.vertx.jooq.shared.async.AbstractAsyncVertxDAO;
 
import java.sql.Timestamp;
import java.util.List;
 
import javax.annotation.Generated;
 
import jooq.generated.tables.User;
import jooq.generated.tables.records.UserRecord;
 
import org.jooq.Configuration;
 
 
import io.reactivex.Single;
import java.util.Optional;
import io.github.jklingsporn.vertx.jooq.rx.async.AsyncRXQueryExecutor;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.11.9"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
@javax.inject.Singleton
public class UserDao extends AbstractAsyncVertxDAO<UserRecord, jooq.generated.tables.pojos.User, String, Single<List<jooq.generated.tables.pojos.User>>, Single<Optional<jooq.generated.tables.pojos.User>>, Single<Integer>, Single<String>> implements io.github.jklingsporn.vertx.jooq.rx.VertxDAO<UserRecord,jooq.generated.tables.pojos.User,String> {
@javax.inject.Inject
 
/**
* @param configuration Used for rendering, so only SQLDialect must be set and must be one of the MYSQL types or POSTGRES.
* @param delegate A configured AsyncSQLClient that is used for query execution
*/
public UserDao(Configuration configuration,io.vertx.reactivex.ext.asyncsql.AsyncSQLClient delegate) {
super(User.USER, jooq.generated.tables.pojos.User.class, new AsyncRXQueryExecutor<UserRecord,jooq.generated.tables.pojos.User,String>(configuration,delegate,jooq.generated.tables.pojos.User::new, User.USER));
}
 
/**
* {@inheritDoc}
*/
@Override
protected String getId(jooq.generated.tables.pojos.User object) {
return object.getUserKey();
}
 
/**
* Find records that have <code>user_email IN (values)</code> asynchronously
*/
public Single<List<jooq.generated.tables.pojos.User>> findManyByUserEmail(List<String> values) {
return findManyByCondition(User.USER.USER_EMAIL.in(values));
}
 
/**
* Find records that have <code>user_change_date IN (values)</code> asynchronously
*/
public Single<List<jooq.generated.tables.pojos.User>> findManyByUserChangeDate(List<Timestamp> values) {
return findManyByCondition(User.USER.USER_CHANGE_DATE.in(values));
}
 
@Override
public AsyncRXQueryExecutor<UserRecord,jooq.generated.tables.pojos.User,String> queryExecutor(){
return (AsyncRXQueryExecutor<UserRecord,jooq.generated.tables.pojos.User,String>) super.queryExecutor();
}
}
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].