Skip to content

Commit

Permalink
update readme to new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Randall committed Jan 4, 2018
1 parent 7813937 commit dd4c637
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This project is a work in progress. Feedback is encouraged.
## Usage
```go
// setup batch function
batchFn := func(ctx context.Context, keys []interface{}) []*dataloader.Result {
batchFn := func(ctx context.Context, keys dataloader.Keys) []*dataloader.Result {
var results []*dataloader.Result
// do some aync work to get data for specified keys
// append to this list resolved values
Expand All @@ -31,7 +31,7 @@ loader := dataloader.NewBatchedLoader(batchFn)
* closure over a value (in this case an interface value and error).
* When called, it will block until the value is resolved.
*/
thunk := loader.Load(ctx.TODO(), "key1")
thunk := loader.Load(ctx.TODO(), dataloader.StringKey("key1")) // StringKey is a convenience method that make wraps string to implement `Key` interface
result, err := thunk()
if err != nil {
// handle data error
Expand Down

0 comments on commit dd4c637

Please sign in to comment.