Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch[K comparable, V any] struct { // contains filtered or unexported fields }
func (*Batch[K, V]) Keys ¶
func (b *Batch[K, V]) Keys() (output []K)
Keys returns the "scheduled" keys to be fetched.
type Loader ¶
type Loader[K comparable, V any] struct { Resolver func(context.Context, ...K) (map[K]V, error) }
Loader is a specific "batch" of calls to the loader resolver.
func LoaderFor ¶
func LoaderFor[K comparable, V any](dbc *db.Connection, opts ...db.InvocationOption) Loader[K, V]
LoaderFor returns a loader for a given type.
Specifically it uses a `GetMany` command on the dbc to fetch the keys for a given batch.
There are very specific constraints on the types we can use as the values here, specifically the types can only have (1) primary key, and the key values will be resolved with reflection incurring a bit of a performance hit.
Click to show internal directories.
Click to hide internal directories.