From ac85ba66d95b1629788c7f97d67a9f878c0a9834 Mon Sep 17 00:00:00 2001 From: mactep Date: Tue, 10 Oct 2023 18:45:58 -0300 Subject: [PATCH] Update docs to include the exported gRPC approach --- docs/modules/grpc.md | 8 ++++---- docs/project-structure.md | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/modules/grpc.md b/docs/modules/grpc.md index 803c38d..9a1650f 100644 --- a/docs/modules/grpc.md +++ b/docs/modules/grpc.md @@ -9,7 +9,7 @@ Install the prerequisites listed in [gRPC Go - Quick Start](https://grpc.io/docs Add the following code to `cmd/generate/generate.go`: ``` -//go:generate sh -c "protoc --experimental_allow_proto3_optional --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --proto_path=../transport-inbound/grpc/proto/ --go_out=./grpc/ --go-grpc_out=./grpc/ ../transport-inbound/grpc/proto/*.proto" +//go:generate sh -c "protoc --experimental_allow_proto3_optional --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --proto_path=../transport-inbound/grpc/proto --go_out=../../pkg/grpc/ --go-grpc_out=../../pkg/grpc/ ../transport-inbound/grpc/proto/*.proto" ``` In `main.go`: @@ -74,7 +74,7 @@ import ( "github.com/example/package/v3/internal/features/commands" "github.com/example/package/internal/features/queries" - pb "github.com/example/package/internal/generated/grpc" + pb "github.com/example/package/pkg/grpc" featureserver "github.com/example/package/internal/transport-inbound/grpc/feature-server" "github.com/rs/zerolog" @@ -161,7 +161,7 @@ package featureserver import ( "github.com/example/package/internal/features/commands" "github.com/example/package/internal/features/queries" - pb "github.com/example/package/internal/generated/grpc" + pb "github.com/example/package/pkg/grpc" ) // FeatureServer defines the feature server @@ -199,7 +199,7 @@ import ( "github.com/example/package/internal/transport-inbound/grpc/feature-server/formatters" "github.com/example/package/internal/transport-inbound/grpc/feature-server/parsers" - pb "github.com/example/package/internal/generated/grpc" + pb "github.com/example/package/pkg/grpc" ) // ListFeatureEntities ... diff --git a/docs/project-structure.md b/docs/project-structure.md index 4775b4b..a756cbf 100644 --- a/docs/project-structure.md +++ b/docs/project-structure.md @@ -58,6 +58,11 @@ the database / ORM without the use of your repository. This is where the code for any other feature that does not fit into the above categories or transport modules should go. +### `pkg/grpc` + +This is where `protoc` outputs the generated code for your gRPC services. You +shouldn't add any code here manually. + ### Examples #### `internal/features/controller`