Documentation
¶
Overview ¶
Package once contains the implementation details for the once strategy.
The once strategy executes the batch function for every call to Thunk or ThunkMany. It can be configured to call the batch function when Thunk or ThunkMany is called, or the batch function can be called in a background go routine. Defaults to executing per call to Thunk/ThunkMany.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOnceStrategy ¶
func NewOnceStrategy(opts ...Option) dataloader.StrategyFunction
NewOnceStrategy returns a new instance of the once strategy. The Once strategy calls the batch function for each call to the Thunk if InBackground is false. Otherwise it runs the batch function in a background go routine and blocks calls to Thunk or ThunkMany if the result is not yet fetched.
Types ¶
type Option ¶ added in v0.4.0
type Option func(*options)
Option accepts the dataloader and sets an option on it.
func WithInBackground ¶ added in v0.4.0
func WithInBackground() Option
WithInBackground configures the strategy to load in the background
func WithLogger ¶ added in v0.5.1
WithLogger configures the logger for the strategy. Default is a no op logger.