Documentation
¶
Overview ¶
Package resource contains utilities for performing low-level manipulations of projection resource versions.
Index ¶
- Variables
- func DeleteResource(ctx context.Context, h dogma.ProjectionMessageHandler, r []byte) (bool error)
- func StoreVersion(ctx context.Context, h dogma.ProjectionMessageHandler, r, v []byte) error
- func UpdateVersion(ctx context.Context, h dogma.ProjectionMessageHandler, r, c, n []byte) (ok bool, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("the handler does not support this operation")
ErrNotSupported indicates that the handler does not support a low-level resource operation.
Functions ¶
func DeleteResource ¶
func DeleteResource( ctx context.Context, h dogma.ProjectionMessageHandler, r []byte, ) (bool error)
DeleteResource removes all information about the resource r from the handler's data store.
For some handler implementations, this is *likely* to be an equivalent operation to h.CloseResource(), however handler implementations are not *required* to remove data about a resource when it is closed.
Furthermore, the result of deleting a resource should be that the handler will behave as though it had never had such a resource, whereas the behavior of a projection when using a closed resource is undefined.
It returns ErrNotSupported if the handler does not support deleting resources.
func StoreVersion ¶
StoreVersion unconditionally sets the version of the resource r to v.
Care should be taken using this function, as it bypasses the optimistic-concurrency checks normally present when updating a resource version. It's almost always better to use UpdateVersion() instead.
It returns ErrNotSupported if the handler does not support storing resource versions outside of when an event is handled.
func UpdateVersion ¶
func UpdateVersion( ctx context.Context, h dogma.ProjectionMessageHandler, r, c, n []byte, ) (ok bool, err error)
UpdateVersion updates the version of the resource r to n if the current version is c.
It returns false if c is not the current version.
It returns ErrNotSupported if the handler does not support storing resource versions outside of when an event is handled.
Types ¶
This section is empty.