From 5afa5c189aee767ebdcabe018136a5fc40b520d9 Mon Sep 17 00:00:00 2001 From: Nick Randall Date: Wed, 11 Apr 2018 14:44:49 -0400 Subject: [PATCH] Adding support for godep --- Godeps/Godeps.json | 21 ++++++++++ Godeps/Readme | 5 +++ README.md | 100 ++------------------------------------------- 3 files changed, 30 insertions(+), 96 deletions(-) create mode 100644 Godeps/Godeps.json create mode 100644 Godeps/Readme diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json new file mode 100644 index 0000000..77e8314 --- /dev/null +++ b/Godeps/Godeps.json @@ -0,0 +1,21 @@ +{ + "ImportPath": "github.com/graph-gophers/dataloader", + "GoVersion": "go1.10", + "GodepVersion": "v80", + "Deps": [ + { + "ImportPath": "github.com/opentracing/opentracing-go", + "Comment": "v1.0.2-5-g1361b9c", + "Rev": "1361b9cd60be79c4c3a7fa9841b3c132e40066a7" + }, + { + "ImportPath": "github.com/opentracing/opentracing-go/log", + "Comment": "v1.0.2-5-g1361b9c", + "Rev": "1361b9cd60be79c4c3a7fa9841b3c132e40066a7" + }, + { + "ImportPath": "golang.org/x/net/context", + "Rev": "5ccada7d0a7ba9aeb5d3aca8d3501b4c2a509fec" + } + ] +} diff --git a/Godeps/Readme b/Godeps/Readme new file mode 100644 index 0000000..4cdaa53 --- /dev/null +++ b/Godeps/Readme @@ -0,0 +1,5 @@ +This directory tree is generated automatically by godep. + +Please do not edit. + +See https://github.com/tools/godep for more information. diff --git a/README.md b/README.md index 139be66..906068b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,12 @@ # DataLoader -[![GoDoc](https://godoc.org/gopkg.in/nicksrandall/dataloader.v3?status.svg)](https://godoc.org/github.com/nicksrandall/dataloader) -[![Build Status](https://travis-ci.org/nicksrandall/dataloader.svg?branch=master)](https://travis-ci.org/nicksrandall/dataloader) -[![codecov](https://codecov.io/gh/nicksrandall/dataloader/branch/master/graph/badge.svg)](https://codecov.io/gh/nicksrandall/dataloader) +[![GoDoc](https://godoc.org/gopkg.in/graph-gophers/dataloader.v3?status.svg)](https://godoc.org/github.com/graph-gophers/dataloader) +[![Build Status](https://travis-ci.org/graph-gophers/dataloader.svg?branch=master)](https://travis-ci.org/graph-gophers/dataloader) +[![codecov](https://codecov.io/gh/graph-gophers/dataloader/branch/master/graph/badge.svg)](https://codecov.io/gh/graph-gophers/dataloader) This is an implementation of [Facebook's DataLoader](https://github.com/facebook/dataloader) in Golang. -## Status -This project is a work in progress. Feedback is encouraged. - ## Install -`go get -u gopkg.in/nicksrandall/dataloader.v5` +`go get -u github.com/graph-gophers/dataloader` ## Usage ```go @@ -40,95 +37,6 @@ if err != nil { log.Printf("value: %#v", result) ``` -## Upgrade from v1 to v2 -The only difference between v1 and v2 is that we added use of [context](https://golang.org/pkg/context). - -```diff -- loader.Load(key string) Thunk -+ loader.Load(ctx context.Context, key string) Thunk -- loader.LoadMany(keys []string) ThunkMany -+ loader.LoadMany(ctx context.Context, keys []string) ThunkMany -``` - -```diff -- type BatchFunc func([]string) []*Result -+ type BatchFunc func(context.Context, []string) []*Result -``` - -## Upgrade from v2 to v3 -```diff -// dataloader.Interface as added context.Context to methods -- loader.Prime(key string, value interface{}) Interface -+ loader.Prime(ctx context.Context, key string, value interface{}) Interface -- loader.Clear(key string) Interface -+ loader.Clear(ctx context.Context, key string) Interface -``` - -```diff -// cache interface as added context.Context to methods -type Cache interface { -- Get(string) (Thunk, bool) -+ Get(context.Context, string) (Thunk, bool) -- Set(string, Thunk) -+ Set(context.Context, string, Thunk) -- Delete(string) bool -+ Delete(context.Context, string) bool - Clear() -} -``` - -## Upgrade from v3 to v4 -```diff -// 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 -``` - -```diff -// 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() -} -``` - -## Upgrade from v4 to v5 -```diff -// dataloader.Interface as now allows interace{} as key rather than string -- loader.Load(context.Context, key interface{}) Thunk -+ loader.Load(ctx context.Context, key Key) Thunk -- loader.LoadMany(context.Context, key []interface{}) ThunkMany -+ loader.LoadMany(ctx context.Context, keys Keys) ThunkMany -- loader.Prime(context.Context, key interface{}, value interface{}) Interface -+ loader.Prime(ctx context.Context, key Key, value interface{}) Interface -- loader.Clear(context.Context, key interface{}) Interface -+ loader.Clear(ctx context.Context, key Key) Interface -``` - -```diff -// cache interface now allows interface{} as key instead of string -type Cache interface { -- Get(context.Context, interface{}) (Thunk, bool) -+ Get(context.Context, Key) (Thunk, bool) -- Set(context.Context, interface{}, Thunk) -+ Set(context.Context, Key, Thunk) -- Delete(context.Context, interface{}) bool -+ Delete(context.Context, Key) bool - Clear() -} -``` - ### Don't need/want to use context? You're welcome to install the v1 version of this library.