Class DB<A>
java.lang.Object
fj.control.db.DB<A>
The DB monad represents a database action, or a value within the context of a database connection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal F<Connection, Callable<A>> Returns the callable-valued function projection of this database action.final <B> DB<B> Binds the given action across the result of this database action.static <A> DB<A> db(F<Connection, A> f) Constructs a database action as a function from a database connection to a value.static <A> DB<A> db(Try1<Connection, A, SQLException> t) Constructs a database action as a function from a database connection to a value.static <A> DB<A> Removes one layer of monadic structure.Promotes any given function so that it transforms between values in the database.final <B> DB<B> Map a function over the result of this action.abstract Arun(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.
-
Constructor Details
-
DB
public DB()
-
-
Method Details
-
run
Executes the database action, given a database connection.- Parameters:
c- The connection against which to execute the action.- Returns:
- The result of the action.
- Throws:
SQLException- if a database error occurred.
-
db
Constructs a database action as a function from a database connection to a value.- Parameters:
f- A function from a database connection to a value.- Returns:
- A database action representing the given function.
-
db
Constructs a database action as a function from a database connection to a value.- Parameters:
t- A function from a database connection to a value allowed to throw SQLException- Returns:
- A database action representing the given function.
-
asFunction
Returns the callable-valued function projection of this database action.- Returns:
- The callable-valued function which is isomorphic to this database action.
-
map
-
liftM
-
unit
Constructs a database action that returns the given value completely intact.- Parameters:
a- A value to be wrapped in a database action.- Returns:
- A new database action that returns the given value.
-
bind
-
join
-