!22 修复 gen-structure

Merge pull request !22 from bandl/fix-gen-struct
This commit is contained in:
bandl 2021-09-20 08:39:11 +00:00 committed by Gitee
commit 20b2272e7c
6 changed files with 20 additions and 49 deletions

View File

@ -23,4 +23,8 @@ gen-struct:
.PHONY: gen-protobuf .PHONY: gen-protobuf
gen-protobuf: gen-protobuf:
@python3 ./shell/gen_protobuf.py @python3 ./shell/gen_protobuf.py
.PHONY: gen-structure-interface
gen-structure-interface:
@python3 ./shell/gen_struct_interface.py

View File

@ -6,12 +6,4 @@ STRING_X:
- add - add
- reduce - reduce
- setbit - setbit
- getbit - getbit
LIST_X:
- l_set
- l_get
- l_add
- l_queue
- l_setbit
- l_getbit

View File

@ -4,7 +4,7 @@ option go_package = "pkg/proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
message BaseKey { message BaseKey {
string key = 1; string key = 1;
int64 ttl = 2; int64 ttl = 2;
google.protobuf.Timestamp expire = 3; google.protobuf.Timestamp expire = 3;
} }

View File

@ -1,22 +0,0 @@
syntax = "proto3";
import "base.proto";
option go_package = "pkg/proto";
message LSetRequest {
BaseKey key = 1;
}
message LGetRequest {
BaseKey key = 1;
}
message LAddRequest {
BaseKey key = 1;
}
message LQueueRequest {
BaseKey key = 1;
}
message LSetbitRequest {
BaseKey key = 1;
}
message LGetbitRequest {
BaseKey key = 1;
}

View File

@ -1,31 +1,28 @@
syntax = "proto3"; syntax = "proto3";
import "base.proto"; import "base.proto";
option go_package = "pkg/proto"; option go_package = "pkg/proto";
message SetRequest { message SetRequest {
BaseKey key = 1; BaseKey key = 1;
string value = 2; string value = 2;
} }
message GetRequest { message GetRequest {
BaseKey key = 1; BaseKey key = 1;
} }
message AddRequest { message AddRequest {
BaseKey key = 1; BaseKey key = 1;
int64 value = 2;
} }
message ReduceRequest { message ReduceRequest {
BaseKey key = 1; BaseKey key = 1;
} }
message SetbitRequest { message SetbitRequest {
BaseKey key = 1; BaseKey key = 1;
} }
message GetbitRequest { message GetbitRequest {
BaseKey key = 1; BaseKey key = 1;
} }

View File

@ -48,7 +48,7 @@ def mkdir(cfg_camel):
file = open(proto_path,'w') file = open(proto_path,'w')
file.write('syntax = "proto3";\nimport "base.proto";\noption go_package = "pkg/proto";\n') file.write('syntax = "proto3";\nimport "base.proto";\noption go_package = "pkg/proto";\n')
for v in value: for v in value:
file.write('\nmessage ' + v +'Request '+'{\n\tBaseKey key = 1;\n}') file.write('\nmessage ' + v +'Request '+'{\n BaseKey key = 1;\n}\n')
file.close() file.close()
else: # 如果这个文件存在 else: # 如果这个文件存在
with open(proto_path) as f: with open(proto_path) as f:
@ -64,7 +64,7 @@ def mkdir(cfg_camel):
break break
if flag == 0: if flag == 0:
file = open(proto_path,'a') file = open(proto_path,'a')
file.write('\nmessage ' + v +'Request '+'{\n\tBaseKey key = 1;\n}') file.write('\nmessage ' + v +'Request '+'{\n BaseKey key = 1;\n}\n')
file.close() file.close()
flag = 0 flag = 0