Skip to content

Commit

Permalink
Merge de1208c into 6aa39c4
Browse files Browse the repository at this point in the history
  • Loading branch information
saturn4er committed Feb 1, 2019
2 parents 6aa39c4 + de1208c commit e1fddee
Show file tree
Hide file tree
Showing 42 changed files with 2,246 additions and 1,075 deletions.
2 changes: 2 additions & 0 deletions Gopkg.lock

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

37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,25 +286,40 @@ proto2gql:
ItemsReviewService:
methods:
List:
data_loader_provider:
name: "ItemReviewsLoader"
data_loaders:
ItemReviewsByIDs:
request_field: "filter.item_ids"
result_field: "reviews"
match_field: "item_id"
type: "1-N" # Relation type (1-N|1-1)
wait_duration: 1h1m1s ( WARNING!! this is only example, use some small duration)

- proto_path: "./apis/category.proto"
services:
CategoryService:
methods:
List:
data_loader_provider:
name: "CategoryLoader"
wait_duration_ms: 5
data_loaders:
CategoriesByIDs:
request_field: "filter.ids"
result_field: "categories"
match_field: "id"
type: "1-1"
wait_duration: 1s


- proto_path: "./apis/user.proto"
services:
UserService:
methods:
List:
data_loader_provider:
name: "UserLoader"
wait_duration_ms: 5
data_loaders:
UsersByIDs:
request_field: "filter.ids"
result_field: "users"
match_field: "id"
type: "1-1"
wait_duration: 1s
- proto_path: "./apis/items.proto"
services:
ItemsService:
Expand All @@ -317,13 +332,13 @@ proto2gql:
data_loaders:
- field_name: "category"
key_field_name: "category_id"
data_loader_name: "CategoryLoader"
data_loader_name: "CategoriesByIDs"
- field_name: "comments"
key_field_name: "id"
data_loader_name: "CommentsLoader"
- field_name: "reviews"
key_field_name: "id"
data_loader_name: "ItemReviewsLoader"
data_loader_name: "ItemReviewsByIDs"

swagger2gql:
output_path: "./generated/schema"
Expand All @@ -346,7 +361,7 @@ swagger2gql:
data_loaders:
- field_name: "user"
key_field_name: "user_id"
data_loader_name: "UserLoader"
data_loader_name: "UserService"

graphql_schemas:
- name: "API"
Expand Down
7 changes: 5 additions & 2 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
default: proto
default: proto generate

proto:
@protoc -I=${GOPATH}/src:. --go_out=plugins=grpc:. proto/example.proto
@protoc -I=${GOPATH}/src:. --go_out=plugins=grpc:. import/proto/import.proto

generate:
cd ../ && $(MAKE) build_templates
go run ../cmd/go2gql/

.PHONY: proto
31 changes: 27 additions & 4 deletions example/generate.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
imports:
- "./import/import.yml"

proto2gql:
output_path: "./out"
paths:
Expand All @@ -27,10 +24,33 @@ proto2gql:
request_type: "QUERY"
getMutatuionMethod:
request_type: "MUTATION"
ListSomeEntities:
data_loaders:
SomeEntitiesByAID:
request_field: "filter.a_ids"
result_field: "entities"
match_field: "a_id"
type: "1-N"
SomeEntitiesByID:
request_field: "filter.ids"
result_field: "entities"
match_field: "id"
type: "1-1"

messages:
- A:
- ^A$:
fields:
message_with_oneoffs: {context_key: "a_msg_with_oneoffs"}
data_loaders:
- field_name: "someEntities2"
key_field_name: "some_entity_ids"
data_loader_name: "SomeEntitiesByID"
- field_name: "someEntities"
key_field_name: "id"
data_loader_name: "SomeEntitiesByAID"
- field_name: "someEntity"
key_field_name: "some_entity_id"
data_loader_name: "SomeEntitiesByID"

graphql_schemas:
- name: "ExampleSchema"
Expand All @@ -50,3 +70,6 @@ graphql_schemas:
type: "SERVICE"
object_name: "ExampleMutation"
service: "ServiceExample"

data_loaders:
output_path: "./out/loaders/"
27 changes: 0 additions & 27 deletions example/import/import.yml

This file was deleted.

Loading

0 comments on commit e1fddee

Please sign in to comment.