Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transaction ¶
Retrieve the transaction in the given context if any, or nil if it doesn't have one.
func WriteAndDispatch ¶
func WriteAndDispatch[T event.Source]( db Database, ctx context.Context, entities []T, switcher func(context.Context, event.Event) error, ) (finalErr error)
Helpers to handle database writes from an array of event sources and handle events dispatching. It will open and manage a transaction if none exist in the given context. This way, we make sure event handlers participates in the same transaction so they are resolved as a whole.
There's no way to add this method to the DB without type conversion so this is the easiest way for now.
Types ¶
type Database ¶
type MigrationsDir ¶
Click to show internal directories.
Click to hide internal directories.