Documentation
¶
Index ¶
- Variables
- func ForeachPluginGenerators(list []string, f func(p *PluginGenerator)) error
- func ParseTemplate(h *TemplateHeader) error
- func RegPluginGenerator(pg *PluginGenerator)
- func RegTemplate(h *TemplateHeader)
- type ConstValue
- type DefineField
- type DefineST
- type DefineSTOption
- type File
- type Generator
- type GeneratorConfig
- type Message
- type MessageFileOption
- type MessageOption
- type Parser
- type ParserConfig
- type PluginFuncAppendConstValue
- type PluginFuncAppendDefineField
- type PluginFuncAppendDefineST
- type PluginFuncAppendFile
- type PluginFuncAppendMessage
- type PluginGenerator
- type PrototypeSet
- type TemplateHeader
Constants ¶
This section is empty.
Variables ¶
View Source
var ArrGenerator = []Generator{}
View Source
var ArrParser = []Parser{}
View Source
var TemplateFileMap = map[string]string{}
Functions ¶
func ForeachPluginGenerators ¶ added in v0.2.0
func ForeachPluginGenerators(list []string, f func(p *PluginGenerator)) error
func ParseTemplate ¶ added in v0.2.0
func ParseTemplate(h *TemplateHeader) error
func RegPluginGenerator ¶ added in v0.2.0
func RegPluginGenerator(pg *PluginGenerator)
func RegTemplate ¶ added in v0.2.0
func RegTemplate(h *TemplateHeader)
Types ¶
type ConstValue ¶
type DefineField ¶
type DefineField struct { BuiltinType reflect.Kind `json:"builtin_type,omitempty"` CustomType string `json:"custom_type,omitempty"` //DefineST.Name CustomTypePackage string `json:"custom_type_package,omitempty"` IsArray bool `json:"is_array,omitempty"` IsMap bool `json:"is_map,omitempty"` MapKey reflect.Kind `json:"map_key,omitempty"` Doc []string `json:"doc,omitempty"` Comment string `json:"comment,omitempty"` Option map[string]string `json:"tag,omitempty"` }
type DefineST ¶
type DefineST struct { Name string `json:"name,omitempty"` Fields map[string]*DefineField `json:"fields,omitempty"` Doc []string `json:"doc,omitempty"` Option *DefineSTOption `json:"option,omitempty"` }
type DefineSTOption ¶
type File ¶
type File struct { Name string `json:"name,omitempty"` DefineST []*DefineST `json:"define_st,omitempty"` ProtoID map[uint32]*ConstValue `json:"proto_id,omitempty"` ErrCode map[uint32]*ConstValue `json:"err_code,omitempty"` Doc []string `json:"doc,omitempty"` Option *MessageFileOption `json:"option,omitempty"` }
type Generator ¶
type Generator interface { Lang() string Proto() string NewConfig() GeneratorConfig Generate(GeneratorConfig, *PrototypeSet) error }
type GeneratorConfig ¶
type GeneratorConfig interface{}
type Message ¶
type Message struct { //必须有一个相同名称的DefineST Name string `json:"name,omitempty"` ProtoIDName string `json:"proto_id_name,omitempty"` Option *MessageOption `json:"option,omitempty"` }
type MessageFileOption ¶
type MessageOption ¶
type Parser ¶
type Parser interface { Name() string NewConfig() ParserConfig Parse(ParserConfig) (*PrototypeSet, error) }
type ParserConfig ¶
type ParserConfig interface{}
type PluginFuncAppendConstValue ¶ added in v0.2.0
type PluginFuncAppendConstValue func(tmplData interface{}, pSet *PrototypeSet)
type PluginFuncAppendDefineField ¶ added in v0.2.0
type PluginFuncAppendDefineField func(tmplData interface{}, pSet *PrototypeSet, cursor *DefineField)
type PluginFuncAppendDefineST ¶ added in v0.2.0
type PluginFuncAppendDefineST func(tmplData interface{}, pSet *PrototypeSet, cursor *DefineST)
type PluginFuncAppendFile ¶ added in v0.2.0
type PluginFuncAppendFile func(tmplData interface{}, pSet *PrototypeSet, cursor *File)
type PluginFuncAppendMessage ¶ added in v0.2.0
type PluginFuncAppendMessage func(tmplData interface{}, pSet *PrototypeSet, cursor *Message)
type PluginGenerator ¶ added in v0.2.0
type PluginGenerator struct { Name string AppendFile PluginFuncAppendFile AppendMessage PluginFuncAppendMessage AppendDefineST PluginFuncAppendDefineST AppendDefineField PluginFuncAppendDefineField AppendConstValue PluginFuncAppendConstValue }
func GetPluginGenerator ¶ added in v0.2.0
func GetPluginGenerator(name string) *PluginGenerator
type PrototypeSet ¶
type PrototypeSet struct { RootDir string `json:"root_dir,omitempty"` File map[string]*File `json:"file,omitempty"` Message map[string]*Message `json:"message,omitempty"` DefineST map[string]*DefineST `json:"define_st,omitempty"` ProtoID map[uint32]*ConstValue `json:"proto_id,omitempty"` ErrCode map[uint32]*ConstValue `json:"err_code,omitempty"` }
type TemplateHeader ¶ added in v0.2.0
type TemplateHeader struct { Name string Filepath string BuiltinTemplateText string Template *template.Template ActualFilepath string ActualTemplateText string }
func ArrTemplate ¶ added in v0.2.0
func ArrTemplate() []*TemplateHeader
func GetTemplate ¶ added in v0.2.0
func GetTemplate(name string) *TemplateHeader
Click to show internal directories.
Click to hide internal directories.