Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BehaviorType ¶
type BehaviorType string
const ( Skip BehaviorType = "skip" Cover BehaviorType = "cover" Append BehaviorType = "append" )
func (BehaviorType) IsValid ¶
func (t BehaviorType) IsValid() bool
func (BehaviorType) String ¶
func (t BehaviorType) String() string
type CustomizedFileForCustom ¶
type CustomizedFileForIDL ¶
type CustomizedFileForMethod ¶
type FilePathRenderInfo ¶
type FilePathRenderInfo struct {
ModuleDir string // module dir
GoModule string // go module name
IDLName string // idl name, when template type is idl
Namespace string // namespace, when template type is package
PackageName string // package name, when template type is package
ServiceName string // service name, when template type is service or method
MethodName string // method name, when template type is method
}
type GenerateConfig ¶
type GenerateConfig struct {
Templates []*Template `json:"templates"`
GoModule string `json:"go_module"`
ModuleDir string `json:"module_dir"`
IDLType generator.IdlType `json:"idl_type"`
Files []string `json:"files"` // idl files, theses files will be used to generate the code
Extras Extras `json:"extras"`
Options parser.Options `json:"options"`
}
func (*GenerateConfig) UnmarshalJSON ¶
func (config *GenerateConfig) UnmarshalJSON(data []byte) error
type GenerateMode ¶
type GenerateMode string
const ( Custom GenerateMode = "custom" Package GenerateMode = "package" File GenerateMode = "file" Service GenerateMode = "service" Method GenerateMode = "method" )
func (GenerateMode) IsValid ¶
func (t GenerateMode) IsValid() bool
func (GenerateMode) String ¶
func (t GenerateMode) String() string
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
type Template ¶
type Template struct {
Path string `json:"path"` // The generated path and its filename, such as biz/handler/ping.go
Delims [2]string `json:"delims"` // Template Action Instruction Identifier, default: "{{}}"
Body string `json:"body"` // Render template, currently only supports go template syntax
Type GenerateMode `json:"type"` // Template type: file/dir
UpdateBehavior UpdateBehavior `json:"update_behavior"` // Update command behavior; 0:unchanged, 1:regenerate, 2:append
Extras Extras `json:"extras"` // Extra information
}
func (*Template) Preprocess ¶
func (tpl *Template) Preprocess()
type UpdateBehavior ¶
type UpdateBehavior struct {
Type BehaviorType `json:"type"` // Update behavior type: skip/cover/append
// the following variables are used for append update
AppendKey AppendKey `json:"append_key"` // Append content based in key; for example: 'method'/'service'
InsertKey string `json:"insert_key"` // Insert content by "insert_key"
AppendTpl string `json:"append_content_tpl"` // Append content if UpdateBehavior is "append"
ImportTpl []string `json:"import_tpl"` // Import insert template
}
Click to show internal directories.
Click to hide internal directories.