Skip to content

Commit 1d81ccb

Browse files
committed
add a list api for GET methods
1 parent e2c4e45 commit 1d81ccb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1290
-257
lines changed

.github/RELEASE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Change log
22

3-
- Sponge command ui service support docker deployment.
4-
- Adjustment option code.
5-
3+
- Fix bug with naocs as service discovery.
4+
- Add support for distributed transaction manager [DTM](https://github.com/dtm-labs/dtm).
5+
- Add a list api interface for GET methods.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ build-sponge:
104104
# build a sponge docker image, e.g. make image-build-sponge TAG=v1.5.8
105105
image-build-sponge:
106106
@echo "build a sponge docker image'"
107-
@cd cmd/sponge/scripts && bash image-build.sh $(TAG)
107+
@cd cmd/sponge/scripts && bash build-sponge-image.sh $(TAG)
108108

109109
# delete the templates code end
110110

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
<br>
2020

21-
If you are developing a web or microservice with a simple CRUD API interface, you don't need to write a single line of golang code to compile and deploy to servers, dockers, k8s, and the complete service code is generated by sponge.
21+
If you are developing a RESTful web or microservice with a simple CRUD API interface, you don't need to write a single line of golang code to compile and deploy to servers, dockers, k8s, and the complete service code is generated by sponge.
2222

23-
If you develop a generic web or microservice, you need to manually write code in addition to defining the data table, defining the api interface in the proto file, and filling in the specific business logic code in the generated template file. Other golang codes are generated by sponge.
23+
If you develop a generic RESTful web or microservice, you need to manually write code in addition to defining the data table, defining the api interface in the proto file, and filling in the specific business logic code in the generated template file. Other golang codes are generated by sponge.
2424

2525
<br>
2626

@@ -108,6 +108,10 @@ No specific business logic code is included.
108108
- [7_community-single](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
109109
- [8_community-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)
110110

111+
#### Distributed transaction examples
112+
113+
- [9_order-system](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
114+
111115
<br>
112116

113117
**If it's help to you, give it a star ⭐.**

api/serverNameExample/v1/userExample.pb.go

Lines changed: 348 additions & 175 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/serverNameExample/v1/userExample.pb.validate.go

Lines changed: 246 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/serverNameExample/v1/userExample.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,23 @@ service userExample {
159159
};
160160
}
161161

162+
// list userExample by last id
163+
rpc ListByLastID(ListUserExampleByLastIDRequest) returns (ListUserExampleByLastIDReply) {
164+
option (google.api.http) = {
165+
get: "/api/v1/userExample/list"
166+
};
167+
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
168+
summary: "list of userExamples by last id",
169+
description: "list of userExamples by last id",
170+
//security: {
171+
// security_requirement: {
172+
// key: "BearerAuth";
173+
// value: {}
174+
// }
175+
//}
176+
};
177+
}
178+
162179
// list of userExample by query parameters
163180
rpc List(ListUserExampleRequest) returns (ListUserExampleReply) {
164181
option (google.api.http) = {
@@ -282,6 +299,16 @@ message ListUserExampleByIDsReply {
282299
repeated UserExample userExamples = 1;
283300
}
284301

302+
message ListUserExampleByLastIDRequest {
303+
uint64 lastID = 1 [(tagger.tags) = "form:\"lastID\""]; // last id
304+
uint32 limit = 2 [(tagger.tags) = "form:\"limit\""]; // page size
305+
string sort = 3 [(tagger.tags) = "form:\"sort\""]; // sort by column name of table, default is -id, the - sign indicates descending order.
306+
}
307+
308+
message ListUserExampleByLastIDReply {
309+
repeated UserExample userExamples = 1;
310+
}
311+
285312
message ListUserExampleRequest {
286313
types.Params params = 1 [(validate.rules).message.required = true];
287314
}

0 commit comments

Comments
 (0)