feat: 重构 config 和 configexport 包

- 配置加载包 config 更名为 configuration
- 配置导出包 configexport 更名为 pce
- 重构
config 包加载方式,采用加载器的方式,并且支持多加载器
- 重构 configexport
包,支持通过实现模板的方式导出不同格式的数据文件及结构文件
This commit is contained in:
kercylan98
2023-07-17 13:28:17 +08:00
parent 8e2b4ebc89
commit 7e7a504421
36 changed files with 1368 additions and 1580 deletions
+25
View File
@@ -0,0 +1,25 @@
package pce
import (
"github.com/kercylan98/minotaur/utils/super"
"reflect"
"strings"
)
// Field 基本字段类型接口
type Field interface {
// TypeName 字段类型名称
TypeName() string
// Zero 获取零值
Zero() any
// Parse 解析
Parse(value string) any
}
// GetFieldGolangType 获取字段的 Golang 类型
func GetFieldGolangType(field Field) string {
typeOf := reflect.TypeOf(field).Elem()
kind := strings.ToLower(typeOf.Kind().String())
name := strings.ToLower(typeOf.Name())
return super.If(kind == name, kind, name)
}