You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-11Lines changed: 34 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@
24
24
Sponge's core design concept is to reversely generate modular code through `SQL` or `Protobuf` files. These codes can be flexibly and seamlessly combined into various types of backend services, thus greatly improving development efficiency and simplifying backend service development. Sponge's main goals are as follows:
25
25
26
26
- If you develop a web or gRPC service with only CRUD API, you don't need to write any go code to compile and deploy it to Linux servers, dockers, k8s, and you just need to connect to the database to automatically generate the complete backend service go code by sponge.
27
-
- If you develop general web, gRPC, http+gRPC, gRPC gateway services, you only need to focus on the three core parts of `define tables in the database`, `define API description information in the proto file`, and `fill in business logic code in the generated template file`, and other go codes (including CRUD api) are generated by sponge.
27
+
- If you develop general web, gRPC, http+gRPC, gRPC gateway services, you only need to focus on the three core parts of `define tables in the database`, `define API description information in the protobuf file`, and `fill in business logic code in the generated template file`, and other go codes (including CRUD api) are generated by sponge.
28
28
29
29
<br>
30
30
@@ -83,6 +83,7 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
@@ -98,20 +99,19 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
98
99
99
100
### Project Code Directory Structure
100
101
101
-
The project code directory structure created by sponge follows the [project-layout](https://github.com/golang-standards/project-layout) and is structured as follows. Supported repository types are `monolithic application single repository (monolith)`, `microservice multi-repository (multi-repo)`, `microservice single repository (mono-repo)`.
102
+
The project code directory structure created by sponge follows the [project-layout](https://github.com/golang-standards/project-layout).
103
+
104
+
Here is the directory structure for the generated `monolithic application single repository (monolith)` or `microservice multi-repository (multi-repo)` code:
102
105
103
106
```bash
104
107
.
105
-
├── api #Directory for exposing external API interfaces, typically containing proto files and generated *.pb.go files. The directory structure is typically in the form `api/xxx/v1`, where v1 indicates the version.
108
+
├── api #Protobuf files and generated *pb.go directory
106
109
├── assets # Store various static resources, such as images, markdown files, etc.
107
110
├── cmd # Program entry directory
108
-
│ └── serviceName
109
-
│ ├── initial # Program initialization, consisting of three files: initApp initializes configurations, registerServers registers services (HTTP or grpc), and registerClose registers resource cleanup.
110
-
│ └── main.go # Program entry file
111
111
├── configs # Directory for configuration files
112
-
├── deployments #Directory for deployment scripts, supporting Bare Metal, Docker and Kubernetes deployments.
113
-
├─ docs# Directory for API interface Swagger documentation.
114
-
├── i(I)nternal# Directory for business logic code, if the first letter is lowercase (internal), it means private code, if the first letter is capitalised (Internal), it means it can be reused by other code.
├── docs # Directory for API interface Swagger documentation.
114
+
├── internal# Directory for business logic code.
115
115
│ ├── cache # Cache directory wrapped around business logic.
116
116
│ ├── config # Directory for Go structure configuration files.
117
117
│ ├── dao # Data access directory.
@@ -124,9 +124,32 @@ The project code directory structure created by sponge follows the [project-layo
124
124
│ ├── service # Directory for implementing grpc business functionality (specific to grpc services).
125
125
│ └── types # Directory for defining request and response parameter structures for HTTP.
126
126
├── pkg # Directory for shared libraries.
127
-
├── scripts # Directory for scripts, including compilation, execution, code generation, and deployment scripts.
127
+
├── scripts # Directory for scripts.
128
128
├── test# Directory for scripts required for testing services and test SQL.
129
-
└── third_party # Directory for external helper programs, forked code, and other third-party tools.
129
+
├── third_party # Directory for third-party protobuf files or external helper programs.
130
+
├── Makefile # Develop, test, deploy related command sets .
131
+
├── go.mod # Go module dependencies and version control file.
132
+
└── go.sum # Go module dependencies key and checksum file.
133
+
```
134
+
135
+
<br>
136
+
137
+
Here is the directory structure for the generated `microservice monolithic repository (mono-repo)` code (also known as large repository directory structure):
138
+
139
+
```bash
140
+
.
141
+
├── api
142
+
│ ├── server1 # Protobuf files and generated *pb.go directory for service 1.
143
+
│ ├── server2 # Protobuf files and generated *pb.go directory for service 2.
144
+
│ ├── server3 # Protobuf files and generated *pb.go directory for service 3.
145
+
│ └── ...
146
+
├── server1 # Code directory for Service 1, it has a similar structure to the microservice multi repo directory.
147
+
├── server2 # Code directory for Service 2, it has a similar structure to the microservice multi repo directory.
148
+
├── server3 # Code directory for Service 3, it has a similar structure to the microservice multi repo directory.
149
+
├── ...
150
+
├── third_party # Third-party protobuf files.
151
+
├── go.mod # Go module dependencies and version control file.
152
+
└── go.sum # Go module dependencies' checksums and hash keys.
Copy file name to clipboardExpand all lines: assets/install-en.md
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,21 @@ Recommended to use go version 1.20 or above, [https://go.dev/doc/install](https:
9
9
10
10
### Windows Environment
11
11
12
-
> Because sponge depends on some linux commands, git bash and make need to be installed in windows to support the linux command environment.
12
+
Make sure the go locale is installed before installing sponge, and add `GOBIN` to the system environment variable **path**. If it is already set, skip this step:
13
+
14
+
```bash
15
+
#Check if GOBIN directory exists
16
+
go env GOBIN
17
+
18
+
#If empty, GOBIN needs to be set (e.g. D:\go\bin), administrator privileges may be required
19
+
go env -w GOBIN=D:\go\bin
20
+
#Then add GOBIN directory to system path environment variable
21
+
```
13
22
14
23
<br>
15
24
25
+
> Because sponge depends on some linux commands, git bash and make need to be installed in windows to support the linux command environment.
26
+
16
27
For installation convenience, sponge and its dependent programs have been packaged together, download address: [sponge-install.zip](https://drive.google.com/drive/folders/1T55lLXDBIQCnL5IQ-i1hWJovgLI2l0k1?usp=sharing)
0 commit comments