Documentation
¶
Index ¶
- Constants
- Variables
- func BuildComment(comment *ast.CommentGroup) string
- func BuildDoc(doc *ast.CommentGroup) string
- func BuildIdent(ident *ast.Ident) string
- func BuildIdentList(idents []*ast.Ident) []string
- func ParseFlags() (plugin Plugin, config PluginRuntimeConfig, builder *Builder, err error)
- type ArrayType
- type BasicLit
- type BasicType
- type Bean
- type Builder
- type ConstSpec
- type EmbeddedPosition
- type EmbeddedValue
- type Expr
- type ExprBase
- type Extention
- type ExtentionKey
- type Field
- type File
- type FuncType
- type GenDecl
- type Ident
- type ImportSpec
- type MapType
- type ObjectId
- type Package
- type Plugin
- type PluginRuntimeConfig
- func (config *PluginRuntimeConfig) BoolEnv(name string) bool
- func (config *PluginRuntimeConfig) Decode(s string) error
- func (config PluginRuntimeConfig) Encode() string
- func (config *PluginRuntimeConfig) FloatEnv(name string) float64
- func (config *PluginRuntimeConfig) Getenv(name string) string
- func (config *PluginRuntimeConfig) IntEnv(name string) int64
- func (config *PluginRuntimeConfig) UintEnv(name string) uint64
- type PluginSet
- type StructType
- type Tag
- type Type
- type TypeBase
- type VectorType
Constants ¶
View Source
const ( // positions FileHead = "file_head" BeforeImport = "before_import" InImport = "in_import" AfterImport = "after_import" BeforeConst = "before_const" AfterConst = "after_const" BeforeEnum = "before_enum" AfterEnum = "after_enum" BeforeStruct = "before_struct" AfterStruct = "after_struct" BeforeProtocol = "before_protocol" AfterProtocol = "after_protocol" BeforeService = "before_service" AfterService = "after_service" // Extention config filename ExtConfigFilename = "ext.json" )
Variables ¶
View Source
var (
ErrAmbiguousNames = errors.New("ambiguous names")
)
View Source
var (
ErrExtensionName = errors.New("invalid extension name")
)
Functions ¶
func BuildComment ¶
func BuildComment(comment *ast.CommentGroup) string
func BuildIdent ¶
func BuildIdentList ¶
func ParseFlags ¶
func ParseFlags() (plugin Plugin, config PluginRuntimeConfig, builder *Builder, err error)
Types ¶
type ArrayType ¶
func BuildArray ¶
type BasicLit ¶
func BuildBasicLit ¶
type EmbeddedPosition ¶
type EmbeddedPosition string
func (EmbeddedPosition) IsValid ¶
func (pos EmbeddedPosition) IsValid() bool
func (EmbeddedPosition) Match ¶
func (pos EmbeddedPosition) Match(kind, at string) bool
type EmbeddedValue ¶
func (EmbeddedValue) IsValid ¶
func (v EmbeddedValue) IsValid() bool
type Extention ¶
type Extention struct {
Name string `json:"name"`
Author string `json:"author"`
URL string `json:"url"`
Version string `json:"version"`
// language -> position -> embedded_values
EmbeddedAt map[string]map[EmbeddedPosition][]EmbeddedValue `json:"at"`
Path string `json:"path"`
}
func (Extention) Find ¶
func (e Extention) Find(lang, kind, at string) []EmbeddedValue
type ExtentionKey ¶
func GetExtentionKey ¶
func GetExtentionKey(name string) (ExtentionKey, error)
func (ExtentionKey) Path ¶
func (key ExtentionKey) Path(rootdir string) string
func (ExtentionKey) Subdir ¶
func (key ExtentionKey) Subdir() string
type Field ¶
type Field struct {
Doc string
Options []string
Type Type
Names []string
Default Expr
Tag Tag
Comment string
}
func BuildField ¶
func BuildFieldList ¶
func (Field) IsExtended ¶
type File ¶
type GenDecl ¶
type GenDecl struct {
Doc string
Imports []*ImportSpec
Consts []*ConstSpec
}
func BuildGenDecl ¶
type ImportSpec ¶
func BuildImportSpec ¶
func BuildImportSpec(spec *ast.ImportSpec) *ImportSpec
type Package ¶
func BuildPackage ¶
type Plugin ¶
type Plugin struct {
Lang string `json:"lang"`
Name string `json:"name"`
Bin string `json:"bin"`
TemplatesDir string `json:"templates,omitempty"`
RuntimeConfig PluginRuntimeConfig `json:"-"`
}
type PluginRuntimeConfig ¶
type PluginRuntimeConfig struct {
Verbose string
Outdir string
ExtentionsDir string
Extentions []Extention
Envvars map[string]string
}
func (*PluginRuntimeConfig) BoolEnv ¶
func (config *PluginRuntimeConfig) BoolEnv(name string) bool
func (*PluginRuntimeConfig) Decode ¶
func (config *PluginRuntimeConfig) Decode(s string) error
func (PluginRuntimeConfig) Encode ¶
func (config PluginRuntimeConfig) Encode() string
func (*PluginRuntimeConfig) FloatEnv ¶
func (config *PluginRuntimeConfig) FloatEnv(name string) float64
func (*PluginRuntimeConfig) Getenv ¶
func (config *PluginRuntimeConfig) Getenv(name string) string
func (*PluginRuntimeConfig) IntEnv ¶
func (config *PluginRuntimeConfig) IntEnv(name string) int64
func (*PluginRuntimeConfig) UintEnv ¶
func (config *PluginRuntimeConfig) UintEnv(name string) uint64
type PluginSet ¶
type PluginSet struct {
// contains filtered or unexported fields
}
func NewPluginSet ¶
func NewPluginSet() *PluginSet
type StructType ¶
func BuildStruct ¶
func BuildStruct(t *ast.StructType) *StructType
type VectorType ¶
func BuildVector ¶
func BuildVector(t *ast.VectorType) *VectorType
Click to show internal directories.
Click to hide internal directories.