Documentation
¶
Index ¶
- func AnnotateFmtValid(fmt *AnnotateFmt) bool
- func CtxWithConf(ctx context.Context, ac *ActionConfig) context.Context
- func SkipPartErr(ctx context.Context) bool
- type ActionConfig
- type AnnotateConfig
- type AnnotateFmt
- type CutterConfig
- type DeepCut
- type GlobalConfig
- type JsonStrAction
- type OverrunCut
- type UnitCvt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnnotateFmtValid ¶
func AnnotateFmtValid(fmt *AnnotateFmt) bool
func CtxWithConf ¶
func CtxWithConf(ctx context.Context, ac *ActionConfig) context.Context
func SkipPartErr ¶
Types ¶
type ActionConfig ¶
type ActionConfig struct {
SkipPartErr *bool `json:"skip_part_err,omitempty"`
CutterConfig *CutterConfig `json:"cutter_config,omitempty" json:"cutter_config,omitempty"`
AnnotateConfig *AnnotateConfig `json:"annotate_config,omitempty" json:"annotate_config,omitempty"`
}
func LocalLoader ¶
func LocalLoader(configStr string) (*ActionConfig, error)
func (*ActionConfig) WithSkipPartErr ¶
func (a *ActionConfig) WithSkipPartErr() *ActionConfig
type AnnotateConfig ¶
type AnnotateConfig struct {
JsonStr *JsonStrAction `json:"json_str,omitempty"`
NormalAnnotate map[string]*AnnotateFmt `json:"normal_annotate,omitempty"`
EnumAnnotate map[string]*AnnotateFmt `json:"enum_annotate,omitempty"`
ArrayAnnotate map[string]*AnnotateFmt `json:"array_annotate,omitempty"`
}
AnnotateConfig 支持的注释类型. 1. UnmarshalStr 对内嵌json str的处理行为 2. NormalAnnotate 直接在val上增加注释; 路径语法:a.b.c a.b.*.c 3. EnumAnnotate 根据val值进行匹配; 路径语法:a.b.c a.b.*.c 4. ArrayAnnotate val为数组,为每个数组值匹配; 路径语法:a.b.*.c.* 路径语法:a.b.c a.b.*.c a.b.*
type AnnotateFmt ¶
type AnnotateFmt struct {
Str string `json:"str,omitempty"` // 字符串注释
UnitCvt *UnitCvt `json:"unit_cvt,omitempty"` // 单位换算
EnumMap map[string]string `json:"enum_map,omitempty"` // 枚举map
}
AnnotateFmt 按照Str->EnumMap->UnitOp的优先级逐步解析
type CutterConfig ¶
type CutterConfig struct {
IncludeCut []string `json:"include_cut,omitempty"`
ExcludeCut []string `json:"exclude_cut,omitempty"`
DeepCut *DeepCut `json:"deep_cut,omitempty"`
OverrunCut *OverrunCut `json:"overrun_cut,omitempty"`
}
type GlobalConfig ¶
type GlobalConfig struct {
SkipPartErr *bool `json:"skip_part_err,omitempty"`
}
func Conf ¶
func Conf() *GlobalConfig
func (*GlobalConfig) WithSkipPartErr ¶
func (g *GlobalConfig) WithSkipPartErr() *GlobalConfig
type JsonStrAction ¶
type OverrunCut ¶
Click to show internal directories.
Click to hide internal directories.