Documentation
¶
Overview ¶
Package uow provides an interface in which the "repositories" that participate on it are asure that the functions/actions that are called will be rollback if the Unit of Work fails at some point. So it's not necessary to care about removing the already created data if an error raises on the middle of the Unit of Work. It's basically an interface to emulate a Transaction which is a more common word for it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StartUnitOfWork ¶
type StartUnitOfWork func(ctx context.Context, t Type, uowFn UnitOfWorkFn) error
StartUnitOfWork it's the way to initialize a typed UoW, it has a uowFn which is the callback where all the work should be done.
type UnitOfWork ¶
type UnitOfWork interface {
Files() file.Repository
IDXKeys() idxkey.Repository
IDXTTLs() idxttl.Repository
IDXVolumes() idxvolume.Repository
Fs() afero.Fs
Replicas() replica.Repository
Deletions() deletion.Repository
Scrubs() scrub.Repository
State() state.Repository
}
UnitOfWork is the interface that any UnitOfWork has to follow the only methods it as are to return Repositories that work together to achive a common purpose/work.
type UnitOfWorkFn ¶
type UnitOfWorkFn func(ctx context.Context, uw UnitOfWork) error
UnitOfWorkFn is the signature of the function that is the callback of the StartUnitOfWork