|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfj.control.db.DB<A>
public abstract class DB<A>
The DB monad represents a database action, or a value within the context of a database connection.
Constructor Summary | |
---|---|
DB()
|
Method Summary | ||
---|---|---|
F<Connection,Callable<A>> |
asFunction()
Returns the callable-valued function projection of this database action. |
|
|
bind(F<A,DB<B>> f)
Binds the given action across the result of this database action. |
|
static
|
db(F<Connection,A> f)
Constructs a database action as a function from a database connection to a value. |
|
static
|
join(DB<DB<A>> a)
Removes one layer of monadic structure. |
|
static
|
liftM(F<A,B> f)
Promotes any given function so that it transforms between values in the database. |
|
|
map(F<A,B> f)
Map a function over the result of this action. |
|
abstract A |
run(Connection c)
Executes the database action, given a database connection. |
|
static
|
unit(A a)
Constructs a database action that returns the given value completely intact. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DB()
Method Detail |
---|
public abstract A run(Connection c) throws SQLException
c
- The connection against which to execute the action.
SQLException
- if a database error occurred.public static <A> DB<A> db(F<Connection,A> f)
f
- A function from a database connection to a value.
public F<Connection,Callable<A>> asFunction()
public <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 <B> DB<B> bind(F<A,DB<B>> f)
f
- The function to bind across the result of this database action.
public static <A> DB<A> join(DB<DB<A>> a)
a
- A database action that results in another.
|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |