In v4, the key type was changed from string to interface{}, allowing for more flexible key types in both the dataloader.Interface and the Cache interface.
// dataloader.Interface as now allows interace{} as key rather than string
- loader.Load(context.Context, key string) Thunk
+ loader.Load(ctx context.Context, key interface{}) Thunk
- loader.LoadMany(context.Context, key []string) ThunkMany
+ loader.LoadMany(ctx context.Context, keys []interface{}) ThunkMany
- loader.Prime(context.Context, key string, value interface{}) Interface
+ loader.Prime(ctx context.Context, key interface{}, value interface{}) Interface
- loader.Clear(context.Context, key string) Interface
+ loader.Clear(ctx context.Context, key interface{}) Interface
// cache interface now allows interface{} as key instead of string
type Cache interface {
- Get(context.Context, string) (Thunk, bool)
+ Get(context.Context, interface{}) (Thunk, bool)
- Set(context.Context, string, Thunk)
+ Set(context.Context, interface{}, Thunk)
- Delete(context.Context, string) bool
+ Delete(context.Context, interface{}) bool
Clear()
}