Skip to content

Commit 1445aaf

Browse files
author
Nick Randall
committed
update readme
1 parent 766d4e4 commit 1445aaf

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This is an implementation of [Facebook's DataLoader](https://github.com/facebook
99
This 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?
82107
You're welcome to install the v1 version of this library.

0 commit comments

Comments
 (0)