Skip to content

Commit

Permalink
Support for multiple @key directives in federation
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Dunham committed Nov 2, 2021
1 parent 59a3091 commit 7ce0f28
Show file tree
Hide file tree
Showing 10 changed files with 358 additions and 163 deletions.
38 changes: 23 additions & 15 deletions example/federation/accounts/graph/generated/federation.go

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

9 changes: 9 additions & 0 deletions example/federation/products/graph/entity.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ func (r *entityResolver) FindProductByManufacturerIDAndID(ctx context.Context, m
return nil, nil
}

func (r *entityResolver) FindProductByUpc(ctx context.Context, upc string) (*model.Product, error) {
for _, hat := range hats {
if hat.Upc == upc {
return hat, nil
}
}
return nil, nil
}

// Entity returns generated.EntityResolver implementation.
func (r *Resolver) Entity() generated.EntityResolver { return &entityResolver{r} }

Expand Down
53 changes: 35 additions & 18 deletions example/federation/products/graph/generated/federation.go

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

97 changes: 96 additions & 1 deletion example/federation/products/graph/generated/generated.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/federation/products/graph/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Manufacturer @key(fields: "id") {
name: String!
}

type Product @key(fields: "manufacturer { id } id") {
type Product @key(fields: "manufacturer { id } id") @key(fields: "upc") {
id: String!
manufacturer: Manufacturer!
upc: String!
Expand Down
44 changes: 26 additions & 18 deletions example/federation/reviews/graph/generated/federation.go

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

Loading

0 comments on commit 7ce0f28

Please sign in to comment.