From 4459beba61c69f4d407aeed5e99d10cd03027888 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Sat, 23 Oct 2021 23:31:42 +0800 Subject: [PATCH] feat(sturcture temp): update temp --- pkg/structure/generate/interface.template | 29 ------------------- pkg/structure/generate/tem.yaml | 28 ------------------ shell/gen_protobuf.py | 3 +- {pkg/structure => storage/ temp}/const.gen.go | 0 .../generate => storage/ temp}/const.template | 0 storage/ temp/tem.yaml | 28 ++++++++++++++++++ 6 files changed, 29 insertions(+), 59 deletions(-) delete mode 100644 pkg/structure/generate/interface.template delete mode 100644 pkg/structure/generate/tem.yaml rename {pkg/structure => storage/ temp}/const.gen.go (100%) rename {pkg/structure/generate => storage/ temp}/const.template (100%) create mode 100644 storage/ temp/tem.yaml diff --git a/pkg/structure/generate/interface.template b/pkg/structure/generate/interface.template deleted file mode 100644 index d82ada6..0000000 --- a/pkg/structure/generate/interface.template +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by gen-struct. DO NOT EDIT. -// make gen-struct generated - -package structure - -import "gitee.com/timedb/wheatCache/pkg/proto" - -type KeyBaseInterface interface { - SizeByte() int64 - - // RollBack TODO 事务相关, V2 实现 - RollBack() error - // Begin 事务相关, V2 实现 - Begin() error - // Comment 事务相关, V2 实现 - Comment() error - - Encode() ([]byte, error) -} -{% for dict_item in Data %} -{% for key, value in dict_item.items() %} -type {{key}}Interface interface{ - KeyBaseInterface - {% for val in value -%} - {{val}}(*proto.{{val}}Request) (*proto.{{val}}Response, error) - {% endfor %} -} - {% endfor -%} -{%- endfor %} diff --git a/pkg/structure/generate/tem.yaml b/pkg/structure/generate/tem.yaml deleted file mode 100644 index d404084..0000000 --- a/pkg/structure/generate/tem.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# 这里定义结构体的支持的命令, 以后也许会添加结构体的命令验证 -# 定义结构体名称以及方法使, 方法全部小写,结构体名称全部大写且结构体名称需要加上 _X, 如 LIST_X - -STRING_X: - - set - - get - - add - - reduce - - setbit - - getbit - - getrange - - getset - - strlen - - setnx - -LIST_X: - - lindex - - llen - - lpop - - lpush - - lpushx # 列表不存在则不插入 - - lrange - - lrem - - lset - - rpop - - ltrim # 对列表进行切片 - - rpush - - rpushx # 对已经存在的列表尾插 \ No newline at end of file diff --git a/shell/gen_protobuf.py b/shell/gen_protobuf.py index 2954fd8..29d62be 100644 --- a/shell/gen_protobuf.py +++ b/shell/gen_protobuf.py @@ -3,7 +3,7 @@ import os import yaml sysPath = os.getcwd() -tempPath = f"{sysPath}/pkg/structure/generate" +tempPath = f"{sysPath}/pkg/storage/temp" structurePath = f"{sysPath}/pkg/structure" protobufPath = f"{sysPath}/protobuf" @@ -31,7 +31,6 @@ def load_conf(): # 生成对应的数据结构proto文件 def mk_structure(cfg_camel): path = "protobuf" - storagePath = f"{protobufPath}/storage.proto" for key, value in cfg_camel.items(): proto_path = path + '/' + key + '.proto' if not os.path.exists(proto_path): # 如果这个文件不存在 diff --git a/pkg/structure/const.gen.go b/storage/ temp/const.gen.go similarity index 100% rename from pkg/structure/const.gen.go rename to storage/ temp/const.gen.go diff --git a/pkg/structure/generate/const.template b/storage/ temp/const.template similarity index 100% rename from pkg/structure/generate/const.template rename to storage/ temp/const.template diff --git a/storage/ temp/tem.yaml b/storage/ temp/tem.yaml new file mode 100644 index 0000000..6b26d6d --- /dev/null +++ b/storage/ temp/tem.yaml @@ -0,0 +1,28 @@ +# 这里定义 storage 所有可以使用的操作,使用命令验证方案 +# 定义结构体名称以及方法使, 方法全部小写使用 _ 分割,结构体名称全部大写且结构体名称需要加上 _X, 如 LIST_X + +STRING_X: + - set + - get + - add + - reduce + - set_bit + - get_bit + - get_range + - get_set + - str_len + - setnx + +LIST_X: + - l_index + - l_len + - l_pop + - l_push + - l_push_x # 列表不存在则不插入 + - l_range + - l_rem + - l_set + - r_pop + - l_trim # 对列表进行切片 + - r_push + - r_push_x # 对已经存在的列表尾插 \ No newline at end of file