forked from p53841790/wheat-cache
!24 修复自动生成interface脚本
Merge pull request !24 from K-on/fix-gen-interface
This commit is contained in:
commit
2e9216d894
8
makefile
8
makefile
|
@ -17,14 +17,10 @@ install:
|
|||
dev:
|
||||
@./bin/storage storage
|
||||
|
||||
.PHONY: gen-struct-const
|
||||
gen-struct-const:
|
||||
.PHONY: gen-struct
|
||||
gen-struct:
|
||||
@python3 ./shell/make-struct.py
|
||||
|
||||
.PHONY: gen-protobuf
|
||||
gen-protobuf:
|
||||
@python3 ./shell/gen_protobuf.py
|
||||
|
||||
.PHONY: gen-structure-interface
|
||||
gen-structure-interface:
|
||||
@python3 ./shell/gen_struct_interface.py
|
|
@ -1,28 +0,0 @@
|
|||
package structure
|
||||
|
||||
import "gitee.com/timedb/wheatCache/pkg/proto"
|
||||
|
||||
type KeyBaseInterface interface {
|
||||
SizeByte() int64
|
||||
|
||||
// TODO RollBack 事务相关, V2 实现
|
||||
RollBack() error
|
||||
// Begin 事务相关, V2 实现
|
||||
Begin() error
|
||||
// Comment 事务相关, V2 实现
|
||||
Comment() error
|
||||
|
||||
Encode() ([]byte, error)
|
||||
}
|
||||
|
||||
|
||||
type StringXInterface interface {
|
||||
KeyBaseInterface
|
||||
Set(*proto.SetRequest) ([]string, error)
|
||||
Get(*proto.GetRequest) ([]string, error)
|
||||
}
|
||||
|
||||
type ListXInterface interface {
|
||||
KeyBaseInterface
|
||||
LSet(*proto.SetRequest) ([]string, error)
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Code generated by gen-struct-const. DO NOT EDIT.
|
||||
// make gen-struct generated
|
||||
|
||||
package structure
|
||||
|
||||
import "gitee.com/timedb/wheatCache/pkg/proto"
|
||||
|
||||
type KeyBaseInterface interface {
|
||||
SizeByte() int64
|
||||
|
||||
// TODO RollBack 事务相关, 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) ([]string, error)
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor -%}
|
||||
{%- endfor %}
|
|
@ -1,27 +0,0 @@
|
|||
package structure
|
||||
|
||||
import "gitee.com/timedb/wheatCache/pkg/proto"
|
||||
|
||||
type KeyBaseInterface interface {
|
||||
SizeByte() int64
|
||||
|
||||
// TODO RollBack 事务相关, V2 实现
|
||||
RollBack() error
|
||||
// Begin 事务相关, V2 实现
|
||||
Begin() error
|
||||
// Comment 事务相关, V2 实现
|
||||
Comment() error
|
||||
|
||||
Encode() ([]byte, error)
|
||||
}
|
||||
|
||||
type StringXInterface interface {
|
||||
KeyBaseInterface
|
||||
Set(*proto.SetRequest) ([]string, error)
|
||||
Get(*proto.GetRequest) ([]string, error)
|
||||
}
|
||||
|
||||
type ListXInterface interface {
|
||||
KeyBaseInterface
|
||||
LSet(*proto.SetRequest) ([]string, error)
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import os
|
||||
from typing import Dict, List
|
||||
from jinja2 import Template
|
||||
import yaml
|
||||
|
||||
|
@ -80,6 +79,5 @@ def set_structure_interface(conf):
|
|||
|
||||
if __name__ == "__main__":
|
||||
conf, cfg_camel = load_conf()
|
||||
# set_structure_const_template(conf)
|
||||
# set_structure_interface(conf)
|
||||
set_structure_const_template(conf)
|
||||
set_structure_interface(cfg_camel)
|
||||
|
|
Loading…
Reference in New Issue