Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add echo complex method #69

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ go tool pprof localhost:{port}/debug/pprof/{pprof_type}
```bash
# 发送压测请求数
n=5000000
# 请求体类型与请求方法,可选项:("echo", "echoComplex")
method="echo"
# 请求体大小
body=(1024 5120)
# 并发度
Expand Down
11 changes: 8 additions & 3 deletions codec/thrift/echo.thrift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace go echo

// Echo Args

struct Request {
1: required string action,
2: required string msg,
Expand All @@ -10,18 +12,21 @@ struct Response {
2: required string msg,
}

// EchoComplex Args

struct SubMessage {
1: optional i64 id;
2: optional string value;
}

struct Message {
1: optional i64 id;
2: optional string value;
3: optional list<SubMessage> subMessages;
}

// 复杂参数
struct ObjReq {
struct ComplexRequest {
1: required string action(api.path = 'action')
2: required string msg(api.header = 'msg')
3: required map<string, SubMessage> msgMap(api.body = 'msgMap')
Expand All @@ -31,7 +36,7 @@ struct ObjReq {
7: optional string mockCost,
}

struct ObjResp {
struct ComplexResponse {
1: required string action(api.header = 'action')
2: required string msg(api.header = 'msg')
3: required map<string, SubMessage> msgMap(api.body = 'msgMap')
Expand All @@ -42,5 +47,5 @@ struct ObjResp {

service EchoServer {
Response Echo(1: Request req)
ObjResp TestObj(1: ObjReq req)(api.post = '/test/obj/:action', api.baseurl = 'example.com', api.param = 'true', api.serializer = 'json')
ComplexResponse EchoComplex(1: ComplexRequest req)(api.post = '/echo/complex/:action', api.baseurl = 'example.com', api.param = 'true', api.serializer = 'json')
}
Loading
Loading