-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
WIP: Refactor federation requires to populate on entity via a function #2676
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package graph | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/99designs/gqlgen/_examples/federation/reviews/graph/model" | ||
) | ||
|
||
// PopulateUserRequires is the requires populator for the User entity. | ||
func (ec *executionContext) PopulateUserRequires(ctx context.Context, entity *model.User, reps map[string]interface{}) error { | ||
panic(fmt.Errorf("not implemented: PopulateUserRequires")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ range .ExistingImports }} | ||
{{ if ne .Alias "" }} | ||
{{ reserveImport .ImportPath .Alias }} | ||
{{ else }} | ||
{{ reserveImport .ImportPath }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ range .Populators -}} | ||
{{ if .Comment -}} | ||
// {{.Comment}} | ||
{{- else -}} | ||
// {{.FuncName}} is the requires populator for the {{.Entity.Def.Name}} entity. | ||
{{- end }} | ||
func (ec *executionContext) {{.FuncName}}(ctx context.Context, entity *{{.Entity.GetTypeInfo}}, reps map[string]interface{}) error { | ||
{{.Implementation}} | ||
} | ||
{{ end }} | ||
|
||
{{ .OriginalSource }} |
16 changes: 6 additions & 10 deletions
16
plugin/federation/testdata/entityresolver/generated/federation.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
plugin/federation/testdata/entityresolver/generated/federation.requires.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package generated | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/99designs/gqlgen/plugin/federation/testdata/entityresolver/generated/model" | ||
) | ||
|
||
// PopulateMultiHelloMultipleRequiresRequires is the requires populator for the MultiHelloMultipleRequires entity. | ||
func (ec *executionContext) PopulateMultiHelloMultipleRequiresRequires(ctx context.Context, entity *model.MultiHelloMultipleRequires, reps map[string]interface{}) error { | ||
panic(fmt.Errorf("not implemented: PopulateMultiHelloMultipleRequiresRequires")) | ||
} | ||
|
||
// PopulateMultiHelloRequiresRequires is the requires populator for the MultiHelloRequires entity. | ||
func (ec *executionContext) PopulateMultiHelloRequiresRequires(ctx context.Context, entity *model.MultiHelloRequires, reps map[string]interface{}) error { | ||
StevenACoffman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
panic(fmt.Errorf("not implemented: PopulateMultiHelloRequiresRequires")) | ||
} | ||
|
||
// PopulateMultiPlanetRequiresNestedRequires is the requires populator for the MultiPlanetRequiresNested entity. | ||
func (ec *executionContext) PopulateMultiPlanetRequiresNestedRequires(ctx context.Context, entity *model.MultiPlanetRequiresNested, reps map[string]interface{}) error { | ||
StevenACoffman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
panic(fmt.Errorf("not implemented: PopulateMultiPlanetRequiresNestedRequires")) | ||
} | ||
|
||
// PopulatePlanetMultipleRequiresRequires is the requires populator for the PlanetMultipleRequires entity. | ||
func (ec *executionContext) PopulatePlanetMultipleRequiresRequires(ctx context.Context, entity *model.PlanetMultipleRequires, reps map[string]interface{}) error { | ||
panic(fmt.Errorf("not implemented: PopulatePlanetMultipleRequiresRequires")) | ||
} | ||
|
||
// PopulatePlanetRequiresRequires is the requires populator for the PlanetRequires entity. | ||
func (ec *executionContext) PopulatePlanetRequiresRequires(ctx context.Context, entity *model.PlanetRequires, reps map[string]interface{}) error { | ||
panic(fmt.Errorf("not implemented: PopulatePlanetRequiresRequires")) | ||
} | ||
|
||
// PopulatePlanetRequiresNestedRequires is the requires populator for the PlanetRequiresNested entity. | ||
func (ec *executionContext) PopulatePlanetRequiresNestedRequires(ctx context.Context, entity *model.PlanetRequiresNested, reps map[string]interface{}) error { | ||
panic(fmt.Errorf("not implemented: PopulatePlanetRequiresNestedRequires")) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the conditional check, as delete will no-op if the key does not exist