Skip to content

Instantly share code, notes, and snippets.

@jklingsporn
Last active June 7, 2017 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jklingsporn/70366adaf95f14c339aaadf4fcaef83f to your computer and use it in GitHub Desktop.
Save jklingsporn/70366adaf95f14c339aaadf4fcaef83f to your computer and use it in GitHub Desktop.
Rx dao example
public interface VertxDao<R extends UpdatableRecord<R>, P, T> extends DAO<R, P, T> {
/**
* Convenience method to execute any <code>DSLContext</code>-aware Function asynchronously
* using this DAO's <code>configuration</code>.
*
* @param function
* @param <X>
* @return Single
*/
<X> Single<X> executeAsync(Function<DSLContext, X> function);
/**
* Performs an async <code>INSERT</code> statement for a given POJO
*
* @param object The POJO to be inserted
* @return Completable which succeeds when the blocking method of this type succeeds or fails
* with an <code>DataAccessException</code> if the blocking method of this type throws an exception
* @see #insert(Object)
*/
Completable insertAsync(P object);
/**
* Performs an async <code>UPDATE</code> statement for a given POJO
*
* @param object The POJO to be updated
* @return Completable which succeeds when the blocking method of this type succeeds or fails
* with an <code>DataAccessException</code> if the blocking method of this type throws an exception
* @see #update(Object)
*/
Completable updateAsync(P object);
/**
* Performs an async <code>DELETE</code> statement for a given ID
*
* @param id The ID to be deleted
* @return Completable which succeeds when the blocking method of this type succeeds or fails
* with an <code>DataAccessException</code> if the blocking method of this type throws an exception
* @see #delete(Object...)
*/
Completable deleteByIdAsync(T id);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment