Documentation
¶
Index ¶
- func AddProto(file string, buf *bytes.Buffer)
- func AddRef(filename string, reference map[string]struct{})
- func AddTable(file, sheet string, typeOf int, t string, rows [][]string, rules []string)
- func AddTableFull(file, sheet string, typeOf int, t string, rows [][]string, rules []string, ...)
- func Clear()
- func FindExternalMsgDescriptor(name string) *desc.MessageDescriptor
- func GetConfig(name string) *base.Config
- func GetConfigList() (rets []*base.Config)
- func GetConfigMap() map[string]*base.Config
- func GetContainerOf(name string) int
- func GetConvFunc(name string) func(string) interface{}
- func GetConvType(name string) string
- func GetEnum(name string) *base.Enum
- func GetEnumList() (rets []*base.Enum)
- func GetEnumMap() map[string]*base.Enum
- func GetIndexMap() (rets []int)
- func GetOrNewConfig(file, sheet, name, feature, table string) *base.Config
- func GetOrNewEnum(name string) *base.Enum
- func GetOrNewStruct(file, sheet, name, feature, table string) *base.Struct
- func GetProtoList() []string
- func GetProtoMap() map[string]string
- func GetRefList(file string) []string
- func GetStruct(name string) *base.Struct
- func GetStructList() (rets []*base.Struct)
- func GetStructMap() map[string]*base.Struct
- func GetTable(file, sheet string) *base.Table
- func GetTableList(typeOf int) []*base.Table
- func GetTypeOf(name string) int
- func GetValueOf(name string) int
- func IsExternalEnum(name string) bool
- func IsExternalMsg(name string) bool
- func IsExternalProto(key string) bool
- func LoadExternalProtos(dirs ...string) error
- func NewProto(fileName, name string) *dynamic.Message
- func ParseProto() error
- func SplitArrayType(name string) (string, int)
- func SplitExternalType(name string) (short string, ok bool)
- func SplitMapType(name string) (key, val string, ok bool)
- type ExternalType
- type ExtractOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTableFull ¶ added in v1.2.9
func AddTableFull(file, sheet string, typeOf int, t string, rows [][]string, rules []string, feature, table string)
AddTableFull 是 AddTable 的完整版本,额外携带 feature/table 元信息。
file : 文件名(= 功能名,决定 proto 分桶;保持与旧 key 一致) sheet : 原始 sheet 名(保持与 GetTable 的 key 一致) feature : 功能名(从 xlsx 文件名 @ 前解析;默认 = file) table : 表名(从 sheet 名 @ 前解析)
func Clear ¶
func Clear()
Clear resets every manager-global container so that sequential test cases (or repeated runs) start from a clean slate. Maps are re-initialized to empty (not nil) because the various Add* helpers write to them without a nil check.
注意:convertMgr 不在此清理之列——它由 init() 注册基础标量类型 (int32/string/bool 等)的转换器,是静态表而非累积状态,清空会导致 所有基础类型被识别为"未识别的类型"。
func FindExternalMsgDescriptor ¶ added in v1.2.6
func FindExternalMsgDescriptor(name string) *desc.MessageDescriptor
FindExternalMsgDescriptor 返回外部 message 的 MessageDescriptor(供数据生成反射用)。
func GetConfigList ¶
func GetConfigMap ¶
func GetContainerOf ¶ added in v1.2.6
GetContainerOf 根据类型名前缀判定字段值容器类别。 map[K]V -> ContainerMap;[]... 前缀 -> ContainerArray;其余 -> ContainerSingle。
func GetConvFunc ¶
func GetConvType ¶
func GetEnumList ¶
func GetEnumMap ¶
func GetIndexMap ¶
func GetIndexMap() (rets []int)
func GetOrNewConfig ¶
-----config-------
func GetOrNewStruct ¶
-----struct-------
func GetProtoList ¶
func GetProtoList() []string
func GetProtoMap ¶
func GetRefList ¶
func GetStructList ¶
func GetStructMap ¶
func GetTableList ¶
func GetValueOf ¶
func IsExternalEnum ¶ added in v1.2.6
func IsExternalMsg ¶ added in v1.2.6
func IsExternalProto ¶ added in v1.2.9
IsExternalProto 判断 key 是否来自 -proto-src 外部 proto 载入。 外部 proto 仅用于类型解析,SaveProto 不把它们输出到 -proto 目录。
func LoadExternalProtos ¶ added in v1.2.6
LoadExternalProtos 加载 -proto-src 目录下所有 .proto 文件:
- 读入 protoMgr(key 为相对根路径,如 core/struct.proto,与 import 路径风格一致), 使后续 ParseProto 能统一解析并 cross-link
- 预解析每个文件,提取 message/enum 短名注册到 externalMsgMgr/externalEnumMgr
支持多目录(-proto-src 用路径分隔符拼接,Windows 为分号):先加载全部目录的文件, 再统一预解析一次——import 图可能跨目录(如 service 协议 import 主仓 api/proto 的 goone/options),逐目录解析会因依赖尚未加载而失败刷警告。
key 为相对目录根的路径(去掉目录前缀,保证与 proto 内 import 路径一致)。
func NewProto ¶
NewProto 按 message 名构造 dynamic.Message。 检索策略:
- 先在 fileName 对应的 FileDescriptor 上用全限定名查找(内置 struct/config 的常规路径)
- 找不到则全局遍历所有 descMap(外部 message 可能定义在任意外部 proto 文件)
func ParseProto ¶
func ParseProto() error
func SplitArrayType ¶ added in v1.2.3
func SplitExternalType ¶ added in v1.2.6
SplitExternalType 识别 pb.XXX 外部 proto 引用语法。 命中返回短名 XXX 与 true;否则返回 ok=false。 pb. 是纯语法糖,表示「去外部 proto 注册表检索」。
func SplitMapType ¶ added in v1.2.6
SplitMapType 解析 map[K]V 形式的字段类型。 命中返回 (K 原始名, V 原始名, true);否则返回 ok=false。 仅识别最外层的 map(不递归,嵌套 map 本期不支持)。 注意:V 是首个 ']' 之后的全部内容(V 不被 ']' 包裹),故不能用 HasSuffix("]")。
Types ¶
type ExternalType ¶ added in v1.2.6
ExternalType 描述一个外部 proto 定义的 message 或 enum。 FullName 是全限定名(如 g1.protocol.Reward),Name 是短名(Reward), ProtoFile 是该类型所在 proto 文件的「相对仓库根路径」(如 proto/core/struct.proto), 用于生成 import 语句。
func GetExternalEnum ¶ added in v1.2.6
func GetExternalEnum(name string) *ExternalType
func GetExternalMsg ¶ added in v1.2.6
func GetExternalMsg(name string) *ExternalType
type ExtractOptions ¶ added in v1.2.3
选项配置