-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config option to preserve single file resolvers instead of always rew…
…riting Signed-off-by: Steve Coffman <steve@khanacademy.org>
- Loading branch information
1 parent
b207ed5
commit 99f0354
Showing
10 changed files
with
117 additions
and
17 deletions.
There are no files selected for viewing
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
10 changes: 0 additions & 10 deletions
10
plugin/resolvergen/testdata/followschema/out/schema.resolvers.go
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
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
17 changes: 17 additions & 0 deletions
17
plugin/resolvergen/testdata/singlefile_preserve/gqlgen.yml
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,17 @@ | ||
schema: | ||
- "testdata/schema.graphql" | ||
|
||
exec: | ||
filename: testdata/singlefile_preserve/out/ignored.go | ||
model: | ||
filename: testdata/singlefile_preserve/out/generated.go | ||
resolver: | ||
filename: testdata/singlefile_preserve/out/resolver.go | ||
type: CustomResolverType | ||
preserve_resolver: true | ||
|
||
models: | ||
Resolver: | ||
model: github.com/99designs/gqlgen/plugin/resolvergen/testdata/singlefile_preserve/out.Resolver | ||
|
||
omit_gqlgen_version_in_file_notice: true |
13 changes: 13 additions & 0 deletions
13
plugin/resolvergen/testdata/singlefile_preserve/out/model.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,13 @@ | ||
package customresolver | ||
|
||
import "context" | ||
|
||
type Resolver struct{} | ||
|
||
type QueryResolver interface { | ||
Resolver(ctx context.Context) (*Resolver, error) | ||
} | ||
|
||
type ResolverResolver interface { | ||
Name(ctx context.Context, obj *Resolver) (string, error) | ||
} |
28 changes: 28 additions & 0 deletions
28
plugin/resolvergen/testdata/singlefile_preserve/out/resolver.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,28 @@ | ||
package customresolver | ||
|
||
// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES. | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
type CustomResolverType struct{} | ||
|
||
// Resolver is the resolver for the resolver field. | ||
func (r *queryCustomResolverType) Resolver(ctx context.Context) (*Resolver, error) { | ||
panic("not implemented") | ||
} | ||
|
||
// Name is the resolver for the name field. | ||
func (r *resolverCustomResolverType) Name(ctx context.Context, obj *Resolver) (string, error) { | ||
panic("not implemented") | ||
} | ||
|
||
// Query returns QueryResolver implementation. | ||
func (r *CustomResolverType) Query() QueryResolver { return &queryCustomResolverType{r} } | ||
|
||
// Resolver returns ResolverResolver implementation. | ||
func (r *CustomResolverType) Resolver() ResolverResolver { return &resolverCustomResolverType{r} } | ||
|
||
type queryCustomResolverType struct{ *CustomResolverType } | ||
type resolverCustomResolverType struct{ *CustomResolverType } |