forked from p93542168/wheat-cache
自动生成Interface
This commit is contained in:
parent
b03d096b53
commit
09b8907085
|
@ -65,19 +65,21 @@ def set_structure_const_template(conf: dict):
|
||||||
|
|
||||||
|
|
||||||
def set_structure_interface(conf):
|
def set_structure_interface(conf):
|
||||||
print(conf)
|
text = load_template("interface.template")
|
||||||
|
Dic = {}
|
||||||
# class KeyInterFace
|
template = Template(text)
|
||||||
|
for i in conf.keys():
|
||||||
with open(f"{structurePath}/interface.go") as fp:
|
x = i.lower().title()
|
||||||
interfaceText = fp.read()
|
Dic["".join(x.split("_"))] = conf[i]
|
||||||
|
yamlData = [Dic]
|
||||||
for key, item in conf.items():
|
text = template.render(Data=yamlData)
|
||||||
interfaceKey = "".join([k.capitalize() for k in key.split('_')])
|
temp_path = f"{structurePath}/interface.gen.go"
|
||||||
interfaceTitle = "type "
|
with open(temp_path, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
conf, cfg_camel = load_conf()
|
conf, cfg_camel = load_conf()
|
||||||
set_structure_const_template(conf)
|
# set_structure_const_template(conf)
|
||||||
set_structure_interface(conf)
|
# set_structure_interface(conf)
|
||||||
|
set_structure_interface(cfg_camel)
|
||||||
|
|
Loading…
Reference in New Issue