fix: 修复配置导出工具无法忽略描述前缀为 # 的字段
This commit is contained in:
parent
274402e721
commit
5c180de118
|
@ -194,7 +194,7 @@ func (slf *Xlsx) checkFieldInvalid(field pce.DataField) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(field.Name, "#") || strings.HasPrefix(field.Type, "#") {
|
if strings.HasPrefix(field.Name, "#") || strings.HasPrefix(field.Type, "#") || strings.HasPrefix(field.Desc, "#") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -29,6 +29,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
"github.com/kercylan98/minotaur/utils/log"
|
"github.com/kercylan98/minotaur/utils/log"
|
||||||
"github.com/kercylan98/minotaur/utils/hash"
|
"github.com/kercylan98/minotaur/utils/hash"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sign string
|
type Sign string
|
||||||
|
@ -41,7 +42,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
json = jsonIter.ConfigCompatibleWithStandardLibrary
|
json = jsonIter.ConfigCompatibleWithStandardLibrary
|
||||||
configs map[Sign]any
|
configs atomic.Pointer[map[Sign]any]
|
||||||
signs = []Sign{
|
signs = []Sign{
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{.Name}}Sign,
|
{{.Name}}Sign,
|
||||||
|
@ -188,14 +189,14 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
cs[{{.Name}}Sign] = {{.Name}}
|
cs[{{.Name}}Sign] = {{.Name}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
||||||
configs = cs
|
configs.Store(&cs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetConfigs 获取所有配置
|
// GetConfigs 获取所有配置
|
||||||
func GetConfigs() map[Sign]any {
|
func GetConfigs() map[Sign]any {
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
defer mutex.Unlock()
|
defer mutex.Unlock()
|
||||||
return hash.Copy(configs)
|
return hash.Copy(*configs.Load())
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetConfigSigns 获取所有配置的标识
|
// GetConfigSigns 获取所有配置的标识
|
||||||
|
@ -207,7 +208,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
func Sync(handle func(configs map[Sign]any)) {
|
func Sync(handle func(configs map[Sign]any)) {
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
defer mutex.Unlock()
|
defer mutex.Unlock()
|
||||||
handle(hash.Copy(configs))
|
handle(hash.Copy(*configs.Load()))
|
||||||
}
|
}
|
||||||
`, slf)
|
`, slf)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue