Versions in this module Expand all Collapse all v1 v1.0.1 Jan 7, 2023 Changes in this version + const DefaultParent + const InitFilePath + var DefaultInitImports = map[string]string + var InfoSignature = CodeLine("// DO NOT EDIT. Code-generated file\n") + func CreateTargetDir(path string, suffix string) string + func ExecuteAnnotator(ctx *Context, ator Annotator, filtered []*Annotation) error + func IsFunc(d *Annotation) bool + func IsInterface(d *Annotation) bool + func IsPublic(d *Annotation) bool + func IsStruct(d *Annotation) bool + func MappedAnnotsByFile(annots []*Annotation) map[*File][]*Annotation + func PackageName(path string) string + func ParseRawAnnot(raw string) (name, params string) + func StructTag(tag *ast.BasicLit) reflect.StructTag + func WriteCoder(c *typgo.Context, coder Coder, target string) error + type AliasGenerator struct + Map map[string]string + func NewAliasGenerator(m map[string]string) *AliasGenerator + func (i *AliasGenerator) Generate(val string) string + func (i *AliasGenerator) Imports() []*Import + func (i *AliasGenerator) Keys() []string + type AnnotProcessor interface + ProcessAnnot func(*Context, *Annotation) error + type AnnotatedFileProcessor interface + ProcessAnnotatedFile func(*Context, *File, []*Annotation) error + type Annotation struct + Decl *Decl + Name string + Params reflect.StructTag + func Compile(paths ...string) ([]*Annotation, error) + func Filter(annotations []*Annotation, annotator Annotator) []*Annotation + func (d *Annotation) Dir() string + func (d *Annotation) Package() string + func (d *Annotation) PackagePath() string + func (d *Annotation) Path() string + type Annotator interface + AnnotationName func() string + IsAllowed func(*Annotation) bool + type CodeGenerator struct + Annotators []Annotator + Walker Walker + func (g *CodeGenerator) Execute(c *typgo.Context) error + func (g *CodeGenerator) Task() *typgo.Task + type CodeLine string + func (c CodeLine) Code() string + type CodeLines []string + func (c CodeLines) Code() string + type Coder interface + Code func() string + type Coders []Coder + func (s Coders) Code() string + type Context struct + Annotations []*Annotation + InitAliasGen *AliasGenerator + InitFuncBody CodeLines + MappedCoders map[*File][]Coder + func NewContext(c *typgo.Context, annots []*Annotation) *Context + func (c *Context) AppendInit(s string) + func (i *Context) AppendFileCoder(file *File, coder Coder) + func (i *Context) AppendInitf(format string, args ...interface{}) + func (i *Context) ProvideConstructor(name, importPath, constructor string) + func (i *Context) WriteFile(f *File, target string) error + func (i *Context) WriteInitFile(target string) error + type Decl struct + File *File + type Field struct + Names []string + Type string + type FieldList struct + List []*Field + type File struct + Imports []*Import + Name string + Path string + func (f *File) Code() string + type FilePaths []string + func (f FilePaths) Walk() []string + type Function struct + Body Coder + Docs []string + Name string + Params []*Field + Recv []*Field + Returns []*Field + func CreateFuncDecl(funcDecl *ast.FuncDecl, file *File) *Function + func (f *Function) Code() string + func (f *Function) GetDocs() []string + func (f *Function) GetName() string + func (f *Function) IsMethod() bool + type GenDecl struct + Docs []string + type Import struct + Name string + Path string + func CreateImports(f *ast.File) []*Import + type Interface struct + func CreateInterfaceDecl(typeDecl TypeDecl) *Interface + type Layouts []string + func (l Layouts) Walk() []string + type PostAnnotator interface + AfterAnnotate func(*Context, []*Annotation) error + type PreAnnotator interface + BeforeAnnotate func(*Context, []*Annotation) error + type Struct struct + Fields []*Field + func CreateStructDecl(typeDecl TypeDecl, structType *ast.StructType) *Struct + type Type interface + GetDocs func() []string + GetName func() string + type TypeDecl struct + Docs []string + Name string + func (t *TypeDecl) GetDocs() []string + func (t *TypeDecl) GetName() string + type Walker interface + Walk func() []string