Documentation
¶
Overview ¶
Package storehooks lets a downstream build observe every runtime database pool the config and logs stores open, at the moment it opens.
GORM compiles its callback chain without a lock, so a plugin registered on a pool that is already serving queries races with those queries. Stores call PoolOpened right after a pool is created and before it is shared, which is the one point where registering callbacks is safe. OSS registers nothing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PoolOpened ¶
PoolOpened runs every registered hook for a pool that was just opened and is not yet in use. Stores call it for each runtime pool, including one that replaces a refreshed pool.
func RegisterPoolOpened ¶
func RegisterPoolOpened(fn PoolOpenedFn)
RegisterPoolOpened adds fn to the hooks run for every new runtime pool. Call it before the stores are created; pools opened earlier are not replayed.
Types ¶
type PoolOpenedFn ¶
PoolOpenedFn is called with each new runtime pool. It must not block.