Skip to content

zh1gr/go-grpc-domain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-grpc-domain


Golang example project represent gRPC domain as library.

Golang Client
Golang Server

install


go get github.com/zh1gr/go-grpc-domain

commands


make go_mod - update dependencies and store it in vendor directory in project

make generate_grpc_invoice - this command generates golang files for the gRPC communication protocol from the specified invoice.proto file using protocol buffers compiler (protoc).

Description:
protoc: The Protocol Buffers compiler (protoc) is used to compile the invoice.proto file.
--go_out: Specifies the output directory for Go language files generated from the .proto file. In this case, it's set to invoice directory.
--go_opt: Provides options to --go_out. Here, paths=source_relative sets the import path for generated Go files to be relative to the source directory.
--go-grpc_out: Specifies the output directory for gRPC Go language files generated from the .proto file.
--go-grpc_opt: Provides options to --go-grpc_out. Similar to --go_opt, paths=source_relative sets the import path for generated gRPC Go files to be relative to the source directory.

make update - generates new proto golang files then updates golang dependencies.

project files


  • Makefile - Script containing commands for automating common development tasks such as building, testing, and running the project.
  • invoice.proto - Protocol Buffers (proto) file defining the structure and methods for handling invoices in a gRPC service.
  • invoice - Directory containing generated code from the invoice.proto file, such as Go language structs and methods.
  • go.mod - File defining the module and dependencies for the Go project.
  • vendor - Directory containing third-party dependencies managed by a dependency management tool like Go modules or dep.

invoice.proto description


  • service Invoice - Defines a gRPC service named Invoice.
  • message CreateRequest - Defines a message structure for a request to create an invoice
  • message CreateResponse - Defines a message structure for the response to a create invoice request

Credits


Based by tutorial from Maximilien Andile video

About

Example of gRPC domain protobuf on GoLang

Resources

License

Stars

Watchers

Forks

Packages

No packages published