class TxEffect<DB, R : TxProvider<DB, R>> : Effect<R, TxError>, Logging
Transaction like effect.
Use for SQL/JDBC operations, but anything that works on some "resource - conection" can be implemented using TxProvider interface.
R - provider of resource (also must support update of connection state)
<init> |
Transaction like effect. TxEffect(requiresNew: Boolean = false) |
wrap |
Wrap a business function in a given effect fun <A> wrap(f: (R) -> A): (R) -> Pair<Out<TxError, A>, R> |
andThen |
Composition of effects. fun <R1, E1, R2 : R1, E2> Effect<R2, E2>.andThen(otherEffect: Effect<R1, E1>): Effect<R2, Either<E1, E2>> |
anyError |
fun <R, E> Effect<R, E>.anyError(): Effect<R, Any> |
logger |
Use it to log using slf4j. fun <T : Logging> T.logger(): Logger |
plus |
operator fun <R1, E1, R2 : R1, E2 : E1> Effect<R2, E2>.plus(otherEffect: Effect<R1, E1>): Effect<R2, E1> |
then |
infix fun <R1, E1, R2 : R1, E2> Effect<R2, E2>.then(otherEffect: Effect<R1, E1>): Effect<R2, Either<E1, E2>> |
with |
infix fun <R1, E1, R2 : R1, E2 : E1> Effect<R2, E2>.with(otherEffect: Effect<R1, E1>): Effect<R2, E1> |