public abstract class DB<A>
extends java.lang.Object
Constructor and Description |
---|
DB() |
Modifier and Type | Method and Description |
---|---|
F<java.sql.Connection,java.util.concurrent.Callable<A>> |
asFunction()
Returns the callable-valued function projection of this database action.
|
<B> DB<B> |
bind(F<A,DB<B>> f)
Binds the given action across the result of this database action.
|
static <A> DB<A> |
db(F<java.sql.Connection,A> f)
Constructs a database action as a function from a database connection to a value.
|
static <A> DB<A> |
db(Try1<java.sql.Connection,A,java.sql.SQLException> t)
Constructs a database action as a function from a database connection to a value.
|
static <A> DB<A> |
join(DB<DB<A>> a)
Removes one layer of monadic structure.
|
static <A,B> F<DB<A>,DB<B>> |
liftM(F<A,B> f)
Promotes any given function so that it transforms between values in the database.
|
<B> DB<B> |
map(F<A,B> f)
Map a function over the result of this action.
|
abstract A |
run(java.sql.Connection c)
Executes the database action, given a database connection.
|
static <A> DB<A> |
unit(A a)
Constructs a database action that returns the given value completely intact.
|
public abstract A run(java.sql.Connection c) throws java.sql.SQLException
c
- The connection against which to execute the action.java.sql.SQLException
- if a database error occurred.public static <A> DB<A> db(F<java.sql.Connection,A> f)
f
- A function from a database connection to a value.public static <A> DB<A> db(Try1<java.sql.Connection,A,java.sql.SQLException> t)
t
- A function from a database connection to a value allowed to throw
SQLExceptionpublic final F<java.sql.Connection,java.util.concurrent.Callable<A>> asFunction()
public final <B> DB<B> map(F<A,B> f)
f
- The function to map over the result.public static <A,B> F<DB<A>,DB<B>> liftM(F<A,B> f)
f
- The function to promote.public static <A> DB<A> unit(A a)
a
- A value to be wrapped in a database action.public final <B> DB<B> bind(F<A,DB<B>> f)
f
- The function to bind across the result of this database action.