Skip to content

Commit

Permalink
Update docs to include the exported gRPC approach
Browse files Browse the repository at this point in the history
  • Loading branch information
mactep committed Oct 10, 2023
1 parent 411583c commit 110f470
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/modules/grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ...
Expand Down
5 changes: 5 additions & 0 deletions docs/project-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 110f470

Please sign in to comment.