代码拉取完成,页面将自动刷新
package diutils
import (
"gitee.com/ichub/goconfig/common/base/basedto"
"gitee.com/ichub/goconfig/common/base/baseutils/fileutils"
"gitee.com/ichub/goconfig/common/ichubconfig"
)
func FindKey(key string) bool {
return FindBeanDiUtils().FindKey(key)
}
const ini_di_key = "di"
const ini_di_gen = "generate"
const di_define_file = "/config/di/di_define.ini"
type DiUtils struct {
basedto.BaseEntitySingle
rootdir string
ini *ichubconfig.IchubConfigIni `json:"-"`
//key struct ->bool
Items map[string]string
Rerun map[string]string
}
func NewDiUtils() *DiUtils {
var u = &DiUtils{
rootdir: fileutils.FindRootDir(),
ini: ichubconfig.NewIchubConfigIni(),
}
u.init()
return u
}
func (u *DiUtils) init() {
u.LoadConfig()
}
func (this *DiUtils) FindKey(key string) bool {
b, ok := this.Items[key]
return b == "true" || ok
}
/*
#auto init generate
[generate]
rerun = true
#重新生成
[di]
IchubConfig = true
SingleEntity = true
*/
func (this *DiUtils) LoadConfig() {
var filename = this.rootdir + "/" + di_define_file
if !fileutils.TryFileExist(filename) {
filename = fileutils.FindRootPkg() + "/" + di_define_file
}
this.ini.Load(filename)
this.Items = this.ini.FindMap(ini_di_key)
this.Rerun = this.ini.FindMap(ini_di_gen)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。