Skip to content

Commit afa5ac9

Browse files
committed
feat(jzero): update template
1 parent c41bb6a commit afa5ac9

6 files changed

Lines changed: 23 additions & 17 deletions

File tree

cmd/jzero/.template/frame/api/app/cmd/version.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func printVersion() {
3333
if Version == "" {
3434
Version = "unknown"
3535
}
36-
versionBuffer.WriteString(fmt.Sprintf("ntls version %s %s/%s\n", Version, runtime.GOOS, runtime.GOARCH))
36+
versionBuffer.WriteString(fmt.Sprintf("{{ .APP }} version %s %s/%s\n", Version, runtime.GOOS, runtime.GOARCH))
3737

3838
versionBuffer.WriteString(fmt.Sprintf("Go version %s\n", runtime.Version()))
3939

cmd/jzero/.template/frame/api/app/desc/api/version.api.tpl renamed to cmd/jzero/.template/frame/api/app/desc/api/v1/version.api.tpl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
syntax = "v1"
22

3-
type GetRequest {}
3+
info (
4+
go_package: "version"
5+
version: "v1"
6+
)
7+
8+
type VersionRequest {}
49

5-
type GetResponse {
10+
type VersionResponse {
611
Version string `json:"version"`
712
GoVersion string `json:"goVersion"`
813
Commit string `json:"commit"`
@@ -11,8 +16,9 @@ type GetResponse {
1116

1217
@server(
1318
prefix: /api/v1{{ if has "serverless" .Features }}/{{ .APP }}{{end}}
19+
group: version
1420
)
1521
service {{ .APP | ToCamel }} {
16-
@handler Get
17-
get /version (GetRequest) returns (GetResponse)
22+
@handler Version
23+
get /version (VersionRequest) returns (VersionResponse)
1824
}

cmd/jzero/.template/frame/gateway/app/cmd/version.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func printVersion() {
3333
if Version == "" {
3434
Version = "unknown"
3535
}
36-
versionBuffer.WriteString(fmt.Sprintf("ntls version %s %s/%s\n", Version, runtime.GOOS, runtime.GOARCH))
36+
versionBuffer.WriteString(fmt.Sprintf("{{ .APP }} version %s %s/%s\n", Version, runtime.GOOS, runtime.GOARCH))
3737

3838
versionBuffer.WriteString(fmt.Sprintf("Go version %s\n", runtime.Version()))
3939

cmd/jzero/.template/frame/gateway/app/desc/proto/v1/version.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
1313
};
1414
};
1515

16-
message GetRequest {}
16+
message VersionRequest {}
1717

18-
message GetResponse {
18+
message VersionResponse {
1919
string version = 1;
20-
string goVersion = 2;
20+
string goVersion = 2;
2121
string commit = 3;
22-
string string = 4;
22+
string date = 4;
2323
}
2424

2525
service Version {
26-
rpc Say(GetRequest) returns(GetResponse) {
26+
rpc Version(VersionRequest) returns(VersionResponse) {
2727
option (google.api.http) = {
2828
get: "/api/v1/version"
2929
};

cmd/jzero/.template/frame/rpc/app/cmd/version.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func printVersion() {
3333
if Version == "" {
3434
Version = "unknown"
3535
}
36-
versionBuffer.WriteString(fmt.Sprintf("ntls version %s %s/%s\n", Version, runtime.GOOS, runtime.GOARCH))
36+
versionBuffer.WriteString(fmt.Sprintf("{{ .APP }} version %s %s/%s\n", Version, runtime.GOOS, runtime.GOARCH))
3737

3838
versionBuffer.WriteString(fmt.Sprintf("Go version %s\n", runtime.Version()))
3939

cmd/jzero/.template/frame/rpc/app/desc/proto/v1/version.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ package versionpb;
44

55
option go_package = "./pb/versionpb";
66

7-
message GetRequest {}
7+
message VersionRequest {}
88

9-
message GetResponse {
9+
message VersionResponse {
1010
string version = 1;
11-
string goVersion = 2;
11+
string goVersion = 2;
1212
string commit = 3;
13-
string string = 4;
13+
string date = 4;
1414
}
1515

1616
service Version {
17-
rpc Say(GetRequest) returns(GetResponse) {};
17+
rpc Version(VersionRequest) returns(VersionResponse) {};
1818
}

0 commit comments

Comments
 (0)