Skip to content

Commit dd4c637

Browse files
author
Nick Randall
committed
update readme to new syntax
1 parent 7813937 commit dd4c637

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This project is a work in progress. Feedback is encouraged.
1414
## Usage
1515
```go
1616
// setup batch function
17-
batchFn := func(ctx context.Context, keys []interface{}) []*dataloader.Result {
17+
batchFn := func(ctx context.Context, keys dataloader.Keys) []*dataloader.Result {
1818
var results []*dataloader.Result
1919
// do some aync work to get data for specified keys
2020
// append to this list resolved values
@@ -31,7 +31,7 @@ loader := dataloader.NewBatchedLoader(batchFn)
3131
* closure over a value (in this case an interface value and error).
3232
* When called, it will block until the value is resolved.
3333
*/
34-
thunk := loader.Load(ctx.TODO(), "key1")
34+
thunk := loader.Load(ctx.TODO(), dataloader.StringKey("key1")) // StringKey is a convenience method that make wraps string to implement `Key` interface
3535
result, err := thunk()
3636
if err != nil {
3737
// handle data error

0 commit comments

Comments
 (0)