fix(gen-struct): add struct

This commit is contained in:
bandl 2021-09-20 16:36:47 +08:00
parent 63d6f66770
commit 4b27125092
6 changed files with 20 additions and 49 deletions

View File

@ -23,4 +23,8 @@ gen-struct:
.PHONY: 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
- reduce
- setbit
- getbit
LIST_X:
- l_set
- l_get
- l_add
- l_queue
- l_setbit
- l_getbit
- getbit

View File

@ -4,7 +4,7 @@ option go_package = "pkg/proto";
import "google/protobuf/timestamp.proto";
message BaseKey {
string key = 1;
int64 ttl = 2;
google.protobuf.Timestamp expire = 3;
string key = 1;
int64 ttl = 2;
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";
import "base.proto";
option go_package = "pkg/proto";
message SetRequest {
BaseKey key = 1;
string value = 2;
BaseKey key = 1;
string value = 2;
}
message GetRequest {
BaseKey key = 1;
BaseKey key = 1;
}
message AddRequest {
BaseKey key = 1;
int64 value = 2;
BaseKey key = 1;
}
message ReduceRequest {
BaseKey key = 1;
BaseKey key = 1;
}
message SetbitRequest {
BaseKey key = 1;
BaseKey key = 1;
}
message GetbitRequest {
BaseKey key = 1;
}
BaseKey key = 1;
}

View File

@ -48,7 +48,7 @@ def mkdir(cfg_camel):
file = open(proto_path,'w')
file.write('syntax = "proto3";\nimport "base.proto";\noption go_package = "pkg/proto";\n')
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()
else: # 如果这个文件存在
with open(proto_path) as f:
@ -64,7 +64,7 @@ def mkdir(cfg_camel):
break
if flag == 0:
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()
flag = 0