@@ -9,7 +9,7 @@ This is an implementation of [Facebook's DataLoader](https://github.com/facebook
99This project is a work in progress. Feedback is encouraged.
1010
1111## Install
12- ` go get -u gopkg.in/nicksrandall/dataloader.v3 `
12+ ` go get -u gopkg.in/nicksrandall/dataloader.v4 `
1313
1414## Usage
1515``` go
@@ -77,6 +77,31 @@ type Cache interface {
7777}
7878```
7979
80+ ## Upgrade from v3 to v4
81+ ``` diff
82+ // dataloader.Interface as now allows interace{} as key rather than string
83+ - loader.Load(context.Context, key string) Thunk
84+ + loader.Load(ctx context.Context, key interface{}) Thunk
85+ - loader.LoadMany(context.Context, key []string) ThunkMany
86+ + loader.LoadMany(ctx context.Context, keys []interface{}) ThunkMany
87+ - loader.Prime(context.Context, key string, value interface{}) Interface
88+ + loader.Prime(ctx context.Context, key interface{}, value interface{}) Interface
89+ - loader.Clear(context.Context, key string) Interface
90+ + loader.Clear(ctx context.Context, key interface{}) Interface
91+ ```
92+
93+ ``` diff
94+ // cache interface now allows interface{} as key instead of string
95+ type Cache interface {
96+ - Get(context.Context, string) (Thunk, bool)
97+ + Get(context.Context, interface{}) (Thunk, bool)
98+ - Set(context.Context, string, Thunk)
99+ + Set(context.Context, interface{}, Thunk)
100+ - Delete(context.Context, string) bool
101+ + Delete(context.Context, interface{}) bool
102+ Clear()
103+ }
104+ ```
80105
81106### Don't need/want to use context?
82107You're welcome to install the v1 version of this library.
0 commit comments