Documentation
¶
Index ¶
- Variables
- func DoGenerate(ctx *Context) error
- func DoParse(ctx *Context) error
- func ForeachFileRecursively(dir string, check func(string) bool, fn func(dir, filename string) error) error
- func LoadScript(ctx *Context) error
- func LoadTemplate(ctx *Context) error
- func RegGenerator(generator Generator)
- func RegParser(parser Parser)
- type Config
- type Context
- type DFEnum
- type DFEnumValue
- type DFFieldType
- type DFFile
- type DFSet
- type DFStruct
- type DFStructField
- type DFStructOneOf
- type DFType
- type FConfigModify
- type FGeneratePost
- type FGeneratePre
- type FParsePost
- type FParsePre
- type FTemplateFunc
- type Generator
- type GeneratorConfig
- type Parser
- type ParserConfig
- type ScriptConfig
- type ScriptPackage
- type TemplateConfig
- type TemplateManager
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalConfig = &Config{ Verbose: false, }
View Source
var PredefineTemplateFunc = template.FuncMap{ "BytesToString": func(bs []byte) string { return string(bs) }, "StringsToLower": strings.ToLower, "StringsToUpper": strings.ToUpper, "StringsCompare": strings.Compare, "StringsContains": strings.Contains, "StringsContainsAny": strings.ContainsAny, "StringsCount": strings.Count, "StringsFields": strings.Fields, "StringsHasPrefix": strings.HasPrefix, "StringsHasSuffix": strings.HasSuffix, "StringsIndex": strings.Index, "StringsIndexAny": strings.IndexAny, "StringsJoin": strings.Join, "StringsLastIndex": strings.LastIndex, "StringsLastIndexAny": strings.LastIndexAny, "StringsRepeat": strings.Repeat, "StringsReplace": strings.Replace, "StringsReplaceAll": strings.ReplaceAll, "StringsSplit": strings.Split, "StringsSplitN": strings.SplitN, "StringsSplitAfter": strings.SplitAfter, "StringsSplitAfterN": strings.SplitAfterN, "StringsToTitle": strings.ToTitle, "StringsTrim": strings.Trim, "StringsTrimLeft": strings.TrimLeft, "StringsTrimPrefix": strings.TrimPrefix, "StringsTrimRight": strings.TrimRight, "StringsTrimSpace": strings.TrimSpace, "StringsTrimSuffix": strings.TrimSuffix, "StrconvFormatInt": strconv.FormatInt, "StrconvFormatUint": strconv.FormatUint, "StrconvFormatFloat": strconv.FormatFloat, "StrconvFormatBool": strconv.FormatBool, "StrconvItoa": strconv.Itoa, "StringsToFirstUpper": func(str string) string { if len(str) == 0 { return str } return strings.ToUpper(str[0:1]) + str[1:] }, }
View Source
var Symbols = map[string]map[string]reflect.Value{}
self package symbols
Functions ¶
func ForeachFileRecursively ¶
func LoadScript ¶
func LoadTemplate ¶
func RegGenerator ¶
func RegGenerator(generator Generator)
Types ¶
type Config ¶
type Config struct {
Verbose bool `yaml:"verbose,omitempty"`
Cmd interface{} `yaml:"cmd,omitempty"`
Parser *ParserConfig `yaml:"parser,omitempty"`
Generator *GeneratorConfig `yaml:"generator,omitempty"`
Template *TemplateConfig `yaml:"template,omitempty"`
Script *ScriptConfig `yaml:"script,omitempty"`
}
func (*Config) ToDefault ¶
func (*Config) ToDefault(cfg config.IConfigDefault)
type Context ¶
type Context struct {
DFSet *DFSet
Template *TemplateManager
FuncConfigModify []FConfigModify
FuncParsePre []FParsePre
FuncParsePost []FParsePost
FuncGeneratePre []FGeneratePre
FuncGeneratePost []FGeneratePost
FuncTemplateFunc []FTemplateFunc
}
func NewContext ¶
func NewContext() *Context
func (*Context) AddDefinedFile ¶
type DFEnumValue ¶
type DFFieldType ¶
type DFSet ¶
type DFSet struct {
Files []*DFFile
// contains filtered or unexported fields
}
func (*DFSet) GetFileByPath ¶
type DFStruct ¶
type DFStruct struct {
Name string
SourceFile string
Options map[string]string
Fields []*DFStructField
OneOfs []*DFStructOneOf
Comment string
}
func (*DFStruct) GetField ¶
func (ds *DFStruct) GetField(name string) *DFStructField
func (*DFStruct) GetOneOf ¶
func (ds *DFStruct) GetOneOf(name string) *DFStructOneOf
type DFStructField ¶
type DFStructField struct {
Name string
Options map[string]string
FieldType DFFieldType
Comment string
}
type DFStructOneOf ¶
type DFStructOneOf struct {
Name string
Options map[string]string
Fields []*DFStructField
Comment string
}
type FConfigModify ¶
type FGeneratePost ¶
type FGeneratePre ¶
type FParsePost ¶
type FTemplateFunc ¶
type GeneratorConfig ¶
type GeneratorConfig struct {
GenRoot string `yaml:"genRoot,omitempty"`
Plugins map[string]interface{} `yaml:"plugins,omitempty"`
}
func (*GeneratorConfig) Name ¶
func (*GeneratorConfig) Name() string
func (*GeneratorConfig) ToDefault ¶
func (*GeneratorConfig) ToDefault(cfg config.IConfigDefault)
type ParserConfig ¶
type ParserConfig struct {
Dir []string `yaml:"dir,omitempty"`
DefineSetFile string `yaml:"defineSetFile,omitempty"`
Plugins map[string]interface{} `yaml:"plugins,omitempty"`
}
func (*ParserConfig) Name ¶
func (*ParserConfig) Name() string
func (*ParserConfig) ToDefault ¶
func (*ParserConfig) ToDefault(cfg config.IConfigDefault)
type ScriptConfig ¶
type ScriptConfig struct {
GoPath string
ImportPkg []string
PrepareExec string
PrepareArgs []string
}
func (*ScriptConfig) Name ¶
func (*ScriptConfig) Name() string
func (*ScriptConfig) ToDefault ¶
func (*ScriptConfig) ToDefault(cfg config.IConfigDefault)
type ScriptPackage ¶
type ScriptPackage struct {
ConfigModifyFunc []FConfigModify
ParsePreFunc []FParsePre
ParsePostFunc []FParsePost
GeneratePreFunc []FGeneratePre
GeneratePostFunc []FGeneratePost
TemplateFunc []FTemplateFunc
}
type TemplateConfig ¶
type TemplateConfig struct {
Dir []string `yaml:"dir,omitempty"`
Ext []string `yaml:"ext,omitempty"`
}
func (*TemplateConfig) Name ¶
func (*TemplateConfig) Name() string
func (*TemplateConfig) ToDefault ¶
func (*TemplateConfig) ToDefault(cfg config.IConfigDefault)
type TemplateManager ¶
type TemplateManager struct {
Config *TemplateConfig
RootTemplate *template.Template
}
func NewTemplateManager ¶
func NewTemplateManager() *TemplateManager
Click to show internal directories.
Click to hide internal directories.