Documentation ¶
Index ¶
- func AddLoader[TKey comparable, T any](opts *LoaderOptions, loader ILoaderFactory[TKey, *T])
- func AddLoaderFunc[TKey comparable, T any](opts *LoaderOptions, batchFunc TypedBatchFunc[TKey, T])
- func AddNamedLoaderFunc[TKey comparable, T any](opts *LoaderOptions, name string, batchFunc TypedBatchFunc[TKey, T])
- func GetLoader[TKey comparable, T any](ctx context.Context, name string) *dataloader.Loader[TKey, T]
- func GetTypedLoader[TKey comparable, T any](ctx context.Context) *dataloader.Loader[TKey, T]
- func WithDataLoaderCache(ctx context.Context) context.Context
- type ILoaderFactory
- type InContextCache
- func (c *InContextCache[TKey, TValue]) Clear()
- func (c *InContextCache[TKey, TValue]) Delete(ctx context.Context, key TKey) bool
- func (c *InContextCache[TKey, TValue]) Get(ctx context.Context, key TKey) (dataloader.Thunk[TValue], bool)
- func (c *InContextCache[TKey, TValue]) Set(ctx context.Context, key TKey, value dataloader.Thunk[TValue])
- type LoaderFactory
- type LoaderOptions
- type TypedBatchFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLoader ¶
func AddLoader[TKey comparable, T any](opts *LoaderOptions, loader ILoaderFactory[TKey, *T])
func AddLoaderFunc ¶
func AddLoaderFunc[TKey comparable, T any](opts *LoaderOptions, batchFunc TypedBatchFunc[TKey, T])
func AddNamedLoaderFunc ¶
func AddNamedLoaderFunc[TKey comparable, T any](opts *LoaderOptions, name string, batchFunc TypedBatchFunc[TKey, T])
func GetLoader ¶
func GetLoader[TKey comparable, T any](ctx context.Context, name string) *dataloader.Loader[TKey, T]
func GetTypedLoader ¶
func GetTypedLoader[TKey comparable, T any](ctx context.Context) *dataloader.Loader[TKey, T]
Types ¶
type ILoaderFactory ¶
type ILoaderFactory[TKey comparable, T any] interface { Name() string CreateLoader() *dataloader.Loader[TKey, T] }
type InContextCache ¶
type InContextCache[TKey comparable, TValue any] struct { // contains filtered or unexported fields }
func NewContextCache ¶
func NewContextCache[TKey comparable, TValue any](name string) *InContextCache[TKey, TValue]
NewContextCache constructs a new InMemoryCache
func (*InContextCache[TKey, TValue]) Clear ¶
func (c *InContextCache[TKey, TValue]) Clear()
Clear clears the cache
func (*InContextCache[TKey, TValue]) Delete ¶
func (c *InContextCache[TKey, TValue]) Delete(ctx context.Context, key TKey) bool
Delete deletes item at `key` from cache
func (*InContextCache[TKey, TValue]) Get ¶
func (c *InContextCache[TKey, TValue]) Get(ctx context.Context, key TKey) (dataloader.Thunk[TValue], bool)
Get gets the value at `key` if it exists, returns value (or nil) and bool indicating of value was found
func (*InContextCache[TKey, TValue]) Set ¶
func (c *InContextCache[TKey, TValue]) Set(ctx context.Context, key TKey, value dataloader.Thunk[TValue])
Set sets the `value` at `key` in the cache
type LoaderFactory ¶
type LoaderFactory[TKey comparable, T any] struct { // contains filtered or unexported fields }
func NewLoaderWithName ¶
func NewLoaderWithName[TKey comparable, TResult any](name string, batchFunc TypedBatchFunc[TKey, TResult]) *LoaderFactory[TKey, TResult]
func NewTypedLoader ¶
func NewTypedLoader[TKey comparable, TResult any](batchFunc TypedBatchFunc[TKey, TResult]) *LoaderFactory[TKey, TResult]
func (*LoaderFactory[TKey, T]) CreateLoader ¶
func (tl *LoaderFactory[TKey, T]) CreateLoader() *dataloader.Loader[TKey, T]
func (*LoaderFactory[TKey, T]) Load ¶
func (tl *LoaderFactory[TKey, T]) Load(ctx context.Context, keys []TKey) []*dataloader.Result[T]
func (*LoaderFactory[TKey, T]) Name ¶
func (tl *LoaderFactory[TKey, T]) Name() string
type LoaderOptions ¶
func NewLoaderOptions ¶
func NewLoaderOptions() *LoaderOptions
func (*LoaderOptions) GetLoader ¶
func (lo *LoaderOptions) GetLoader(name string) any
type TypedBatchFunc ¶
Click to show internal directories.
Click to hide internal directories.