sponge

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 0 Imported by: 0

README

sponge 中文

Go Report codecov Go Reference Go

sponge is a microservice framework, a tool to quickly generate web and microservice code. sponge has a rich generating code commands, a total of 12 different functional code, these functional code can be combined into a complete service (similar to artificially broken sponge cells can be automatically reorganized into a new sponge). Microservice code features include logging, service registration and discovery, registry, rate limiter, circuit breaker, trace, metrics monitoring, pprof performance analysis, statistics, caching, CICD. Code decoupling modular design, including the complete project from development to deployment, common code and scripts are automatically generated, only in accordance with the code template to write business logic code, making the development efficiency improved a lot.


sponge generates the code framework

The generated code is based on three approaches Yaml, SQL DDL and Protocol buffers, 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


Installation

(1) install sponge

go install github.com/zhufuyi/sponge/cmd/sponge@latest

(2) install dependency plugins and tools

sponge init

If there is a dependency tool installation error(except protoc), execute the command to retry sponge tools --install


(3) install protoc

Download it from https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3 and add the directory where the protoc file is located under system path.


💡 NOTICE:

If you are using windows environment, you need to install some additional dependency tools, see windows dependency tools for installation steps.


Quick start

Once you have installed sponge and the dependencies, you are ready to go, start the ui service from the command line:

sponge run

Visit http://localhost:24631 in your browser.

💡 NOTICE:

Do not execute the "sponge run" in the directory where the sponge file is located, as this will result in an error:

exec: "sponge": cannot run executable found relative to current directory


A sample web project code generated from sql:

After download the web project code, execute the command to start the service.

# Update swagger documentation
make docs

# Compile and run the service
make run

Generate other types of code you can try yourself.


Documentation

sponge usage documentation


License

See the LICENSE file for licensing information.


Documentation

Overview

Package sponge is a microservice framework, a tool for quickly creating microservice code. sponge has a rich generating code commands, a total of 12 different functional code, these functional code can be combined into a complete service (similar to artificially broken sponge cells can be automatically reorganized into a new sponge ). Microservice code features include logging, service registration and discovery, registry, rate limit, circuit breaker, trace, metrics monitoring, pprof performance analysis, statistics, caching, CICD. The code uses a decoupled layered structure and it's easy to add or replace functional code. As an efficiency-enhancing tool, commonly repeated code is basically generated automatically and only business logic code needs to be populated based on the generated template code examples.

https://github.com/zhufuyi/sponge/blob/main/README.md

sponge -h
sponge a microservice framework, a tool for quickly creating microservice code.

Usage:
sponge [command]

Available Commands:
completion  Generate the autocompletion script for the specified shell
config         Generate go config codes from yaml file
help           Help about any command
init            Initialize sponge
micro        Generate proto, model, dao, service, rpc, rpc-gw, rpc-cli codes
tools         Managing sponge dependency tools
update      Update sponge to the latest version
web          Generate model, dao, handler, http codes

Directories

Path Synopsis
api
cmd
sponge command
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
internal
dao
pkg
app
container/group
Package group provides a sample lazy load container.
Package group provides a sample lazy load container.
jwt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL