.github | ||
api | ||
assets | ||
build | ||
cmd | ||
configs | ||
deployments | ||
docs | ||
examples | ||
internal | ||
pkg | ||
scripts | ||
test | ||
third_party | ||
.gitignore | ||
.golangci.yml | ||
codecov.yml | ||
doc.go | ||
go.mod | ||
go.sum | ||
Jenkinsfile | ||
LICENSE | ||
Makefile | ||
README.md |
sponge 中文文档
sponge is a powerful tool for generating web and microservice code, as well as a microservice framework based on gin and grpc encapsulation. Sponge has a wealth of code generation commands, and different functional codes can be combined to form a complete service (similar to artificially scattered sponge cells that can automatically recombine into a new sponge). Microservice code functions include logging, service registration and discovery, registration center, flow control, fuse, link tracking, metric monitoring, pprof performance analysis, statistics, cache, CICD and other functions. The code is decoupled and modularly designed, making it easy to build complete engineering code from development to deployment, making it more convenient, easy and efficient to develop with Go language.
sponge generates the code framework
The generated code is based on three approaches Yaml, SQL and Protobuf, each possessing different functional code generation, and the framework diagram of the generated code is shown in Figure 1-1.
Figure 1-1 sponge generation code framework diagram
Microservices framework
The microservice code framework created by sponge is shown in Figure 1-2, this is a typical microservice hierarchy with high performance, high scalability, and includes common service governance features.
Figure 1-2 Microservices framework diagram
Supported code types for generation
- Generate complete web service code based on MySQL tables.
- Generate handler code based on MySQL tables, including CRUD code.
- Generate dao code based on MySQL tables, including CRUD code.
- Generate model code based on MySQL tables.
- Generate complete rpc service code based on MySQL tables.
- Generate service code based on MySQL tables, including CRUD code.
- Generate protobuf code based on MySQL tables.
- Generate web service code based on protobuf.
- Generate rpc service code based on protobuf.
- Generate rpc gateway service code based on protobuf.
- Generate corresponding go structure code based on yaml.
- Generate rpc connection code according to parameters.
- Generate cache code according to parameters.
The generated code can be combined into actual project web or microservice code, and the developer only needs to focus on writing the business logic code, online UI interface demo: https://go-sponge.com/ui
Installation
Quick start
After installing the sponge, start the UI service:
sponge run
Visit http://localhost:24631
in your browser, generate code by manipulating it on the page.
Example of sql based web project code generation.
After downloading the web project code, execute the command to start the service.
# update swagger
make docs
# build and run
make run
💡 If you don't want to use the UI interface, you can use the sponge command line to generate code, there is a wealth of examples in the command line helper information, and some of the code generation commands are more convenient than using the UI interface.
Examples of use
- Generate the complete web service project code
- Generate generic web service project code
- Generate complete microservice(gRPC) project code
- Generates generic microservice(gRPC) project code
- Generate rpc gateway service project code
- Generate microservice cluster project code
Documentation
If it's help to you, give it a star ⭐.
License
See the LICENSE file for licensing information.