TransactionalPostgreSqlLoader implements Closure, Loader, OverridingLoader
FinalYes
Execute multiple loaders within PostgreSQL transactions.
Each batch of rows is loaded in its own transaction; rows a wrapped Transformation delivers when the loader is closed (blocking operations drain there) are committed in one final transaction. If any loader fails, the open transaction is rolled back. All wrapped loaders must use the same Client instance as the wrapper - a loader holding its own Client escapes the transaction.
Interfaces
- Closure
- Loader
- OverridingLoader
Methods
- __construct() : mixed
- closure() : void
- Rows a wrapped Transformation buffered (blocking operations - sortBy, aggregate, groupBy->aggregate, pivot, window functions, collect, join) are delivered during the forwarded closure() drain, so delivery here must be transactional too: one transaction over everything the drain flushes, rolled back when it fails.
- load() : void
- loaders() : array<string|int, mixed>
- withIsolationLevel() : self
Methods
__construct()
public
__construct(Client $client, Loader ...$loaders) : mixed
Parameters
- $client : Client
- $loaders : Loader
closure()
Rows a wrapped Transformation buffered (blocking operations - sortBy, aggregate, groupBy->aggregate, pivot, window functions, collect, join) are delivered during the forwarded closure() drain, so delivery here must be transactional too: one transaction over everything the drain flushes, rolled back when it fails.
public
closure(FlowContext $context) : void
Parameters
- $context : FlowContext
load()
public
load(Rows $rows, FlowContext $context) : void
Parameters
- $rows : Rows
- $context : FlowContext
loaders()
public
loaders() : array<string|int, mixed>
Return values
array<string|int, mixed>withIsolationLevel()
public
withIsolationLevel(IsolationLevel $level) : self
Parameters
- $level : IsolationLevel