walterwanderley / xo-grpc

Create a gRPC Server from Database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xo-grpc

Create a gRPC (and HTTP/JSON provided by grpc-gateway reverse proxy) Server from the generated code by the xo project.

Requirements

  • Go 1.20 or superior
  • xo
  • buf
go install github.com/xo/xo@latest
go install github.com/bufbuild/buf/cmd/buf@latest

Installation

go install github.com/walterwanderley/xo-grpc@latest

Example

  1. Generate go code to access your database using xo. For more informations about xo command line parameters, please visit the xo Documentation
mkdir models
xo schema -o models [Database Connection URL] 
  1. Execute xo-grpc to generate the gRPC Server boilerplate code:
xo-grpc models
  1. Run the generated server:
go run . -db [Database Connection URL] -dev -grpcui
  1. Enjoy!

Similar Projects

About

Create a gRPC Server from Database

License:MIT License


Languages

Language:Go 98.7%Language:Shell 0.9%Language:Dockerfile 0.4%