Skip to content

Commit

Permalink
Support for multiple @key directives in federation (reworked)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Dunham authored and carldunham committed Nov 29, 2021
1 parent 497227f commit 6fcc5f5
Show file tree
Hide file tree
Showing 17 changed files with 598 additions and 317 deletions.
39 changes: 23 additions & 16 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
54 changes: 35 additions & 19 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
Loading

0 comments on commit 6fcc5f5

Please sign in to comment.