Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update path to starboard-nz #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### The DATALOADer gENerator [![CircleCI](https://circleci.com/gh/Vektah/dataloaden.svg?style=svg)](https://circleci.com/gh/vektah/dataloaden) [![Go Report Card](https://goreportcard.com/badge/github.com/vektah/dataloaden)](https://goreportcard.com/report/github.com/vektah/dataloaden) [![codecov](https://codecov.io/gh/vektah/dataloaden/branch/master/graph/badge.svg)](https://codecov.io/gh/vektah/dataloaden)
### The DATALOADer gENerator [![CircleCI](https://circleci.com/gh/starboard-nz/dataloaden.svg?style=svg)](https://circleci.com/gh/starboard-nz/dataloaden) [![Go Report Card](https://goreportcard.com/badge/github.com/starboard-nz/dataloaden)](https://goreportcard.com/report/github.com/starboard-nz/dataloaden) [![codecov](https://codecov.io/gh/starboard-nz/dataloaden/branch/master/graph/badge.svg)](https://codecov.io/gh/starboard-nz/dataloaden)

Requires golang 1.11+ for modules support.

Expand All @@ -12,11 +12,11 @@ get used.

From inside the package you want to have the dataloader in:
```bash
go run github.com/vektah/dataloaden UserLoader string *github.com/dataloaden/example.User
go run github.com/starboard-nz/dataloaden UserLoader string *github.com/dataloaden/example.User
```

This will generate a dataloader called `UserLoader` that looks up `*github.com/dataloaden/example.User`'s objects
based on a `string` key.
This will generate a dataloader called `UserLoader` that looks up `*github.com/dataloaden/example.User`'s objects
based on a `string` key.

In another file in the same package, create the constructor method:
```go
Expand Down Expand Up @@ -49,11 +49,11 @@ function once. It also caches values and wont request duplicates in a batch.

#### Returning Slices

You may want to generate a dataloader that returns slices instead of single values. Both key and value types can be a
simple go type expression:
You may want to generate a dataloader that returns slices instead of single values. Both key and value types can be a
simple go type expression:

```bash
go run github.com/vektah/dataloaden UserSliceLoader string []*github.com/dataloaden/example.User
go run github.com/starboard-nz/dataloaden UserSliceLoader string []*github.com/dataloaden/example.User
```

Now each key is expected to return a slice of values and the `fetch` function has the return type `[][]*User`.
Expand All @@ -66,12 +66,12 @@ Create a tools.go that looks like this:

package main

import _ "github.com/vektah/dataloaden"
import _ "github.com/starboard-nz/dataloaden"
```

This will allow go modules to see the dependency.

You can invoke it from anywhere within your module now using `go run github.com/vektah/dataloaden` and
You can invoke it from anywhere within your module now using `go run github.com/starboard-nz/dataloaden` and
always get the pinned version.

#### Wait, how do I use context with this?
Expand Down
2 changes: 1 addition & 1 deletion dataloaden.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/vektah/dataloaden/pkg/generator"
"github.com/starboard-nz/dataloaden/pkg/generator"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion example/pkgname/user.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package differentpkg

//go:generate go run github.com/vektah/dataloaden UserLoader string *github.com/vektah/dataloaden/example.User
//go:generate go run github.com/starboard-nz/dataloaden UserLoader string *github.com/starboard-nz/dataloaden/example.User
4 changes: 2 additions & 2 deletions example/pkgname/userloader_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/slice/user.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//go:generate go run github.com/vektah/dataloaden UserSliceLoader int []github.com/vektah/dataloaden/example.User
//go:generate go run github.com/starboard-nz/dataloaden UserSliceLoader int []github.com/starboard-nz/dataloaden/example.User

package slice

import (
"strconv"
"time"

"github.com/vektah/dataloaden/example"
"github.com/starboard-nz/dataloaden/example"
)

func NewLoader() *UserSliceLoader {
Expand Down
4 changes: 2 additions & 2 deletions example/slice/usersliceloader_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/slice/usersliceloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"github.com/starboard-nz/dataloaden/example"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/vektah/dataloaden/example"
)

func TestUserLoader(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion example/user.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate go run github.com/vektah/dataloaden UserLoader string *github.com/vektah/dataloaden/example.User
//go:generate go run github.com/starboard-nz/dataloaden UserLoader string *github.com/starboard-nz/dataloaden/example.User

package example

Expand Down
2 changes: 1 addition & 1 deletion example/userloader_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module github.com/vektah/dataloaden
module github.com/starboard-nz/dataloaden

go 1.19

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pkg/errors v0.8.1
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.1
golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd
)

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
)
4 changes: 2 additions & 2 deletions pkg/generator/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ func TestParseType(t *testing.T) {
require.Equal(t, &goType{Name: "Time", ImportPath: "time", ImportName: "time"}, parse("time.Time"))
require.Equal(t, &goType{
Name: "Foo",
ImportPath: "github.com/vektah/dataloaden/pkg/generator/testdata/mismatch",
ImportPath: "github.com/starboard-nz/dataloaden/pkg/generator/testdata/mismatch",
ImportName: "mismatched",
}, parse("github.com/vektah/dataloaden/pkg/generator/testdata/mismatch.Foo"))
}, parse("github.com/starboard-nz/dataloaden/pkg/generator/testdata/mismatch.Foo"))
}

func parse(s string) *goType {
Expand Down
6 changes: 3 additions & 3 deletions pkg/generator/template.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/generator/template_no_cache.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.