Versions in this module Expand all Collapse all v0 v0.1.0 Jul 15, 2019 Changes in this version + var BoolType = BasicType(reflect.Bool) + var ByteType = Uint8Type + var Complex128Type = BasicType(reflect.Complex128) + var Complex64Type = BasicType(reflect.Complex64) + var ErrorType = NamedType(Symbol{ ... }) + var Float32Type = BasicType(reflect.Float32) + var Float64Type = BasicType(reflect.Float64) + var Int16Type = BasicType(reflect.Int16) + var Int32Type = BasicType(reflect.Int32) + var Int64Type = BasicType(reflect.Int64) + var Int8Type = BasicType(reflect.Int8) + var IntType = BasicType(reflect.Int) + var RuneType = Int32Type + var StringType = BasicType(reflect.String) + var Uint16Type = BasicType(reflect.Uint16) + var Uint32Type = BasicType(reflect.Uint32) + var Uint64Type = BasicType(reflect.Uint64) + var Uint8Type = BasicType(reflect.Uint8) + var UintType = BasicType(reflect.Uint) + var UintptrType = BasicType(reflect.Uintptr) + var UnsafePointerType = NamedType(NewSymbol("unsafe", "Pointer")) + func Export(s string) string + func Unexport(s string) string + func WriteGoFile(w io.Writer, f *GoFile) error + func WriteGoFiles(outFn func(path string) (io.WriteCloser, error), files ...*GoFile) error + func WriteGoFilesToFileSystem(rootDir string, files ...*GoFile) error + func WriteGoFilesToGoPath(files ...*GoFile) error + type ArgType struct + Name string + Type TypeName + type CodeBlock struct + func Print(text string) *CodeBlock + func Printf(fmt string, args ...interface{}) *CodeBlock + func Println(text string) *CodeBlock + func Printlnf(fmt string, args ...interface{}) *CodeBlock + func RenderCode(template *template.Template, data interface{}) *CodeBlock + func (cb *CodeBlock) AddCode(code *CodeBlock) *CodeBlock + func (cb *CodeBlock) Print(text string) *CodeBlock + func (cb *CodeBlock) Printf(fmt string, args ...interface{}) *CodeBlock + func (cb *CodeBlock) Println(text string) *CodeBlock + func (cb *CodeBlock) Printlnf(fmt string, args ...interface{}) *CodeBlock + func (cb *CodeBlock) RenderCode(template *template.Template, data interface{}) *CodeBlock + type ConstDecl struct + Comment string + Consts []*ConstSpec + func NewConstDecl(cs ...*ConstSpec) *ConstDecl + func (c *ConstDecl) AddConst(cs *ConstSpec) *ConstDecl + func (c *ConstDecl) SetComment(comment string) *ConstDecl + type ConstSpec struct + Comment string + Initializer *CodeBlock + Names []string + Type TypeNameOrSpec + func NewConst(names ...string) *ConstSpec + func (c *ConstSpec) Initialize(fmt string, args ...interface{}) *ConstSpec + func (c *ConstSpec) SetComment(comment string) *ConstSpec + func (c *ConstSpec) SetInitializer(cb *CodeBlock) *ConstSpec + func (c *ConstSpec) SetType(t TypeNameOrSpec) *ConstSpec + func (c *ConstSpec) String() string + func (c *ConstSpec) SymbolAt(i int) Symbol + func (c *ConstSpec) ToSymbol() Symbol + type FieldSpec struct + Comment string + Name string + Tag reflect.StructTag + Type TypeNameOrSpec + func NewField(name string, t TypeNameOrSpec) *FieldSpec + func (f *FieldSpec) SetComment(comment string) *FieldSpec + func (f *FieldSpec) SetTag(tag string) *FieldSpec + func (f *FieldSpec) String() string + type FieldType struct + Name string + Tag reflect.StructTag + Type TypeName + type FileElement interface + type FormatError struct + Err error + Unformatted []byte + func (e *FormatError) Error() string + type FuncSpec struct + Comment string + Name string + Receiver *ReceiverSpec + func NewFunc(name string) *FuncSpec + func NewMethod(rcvr *ReceiverSpec, name string) *FuncSpec + func (f *FuncSpec) AddArg(name string, t TypeName) *FuncSpec + func (f *FuncSpec) AddCode(cb *CodeBlock) *FuncSpec + func (f *FuncSpec) AddResult(name string, t TypeName) *FuncSpec + func (f *FuncSpec) Print(text string) *FuncSpec + func (f *FuncSpec) Printf(fmt string, args ...interface{}) *FuncSpec + func (f *FuncSpec) Println(text string) *FuncSpec + func (f *FuncSpec) Printlnf(fmt string, args ...interface{}) *FuncSpec + func (f *FuncSpec) RenderCode(template *template.Template, data interface{}) *FuncSpec + func (f *FuncSpec) SetComment(comment string) *FuncSpec + func (f *FuncSpec) SetVariadic(isVariadic bool) *FuncSpec + func (f *FuncSpec) String() string + func (f *FuncSpec) ToSymbol() SymbolOrMethodRef + func (f *FuncSpec) ToTypeName() TypeName + type GoFile struct + CanonicalImportPath string + FileComment string + Name string + PackageComment string + PackageName string + func NewGoFile(fileName, packagePath, packageName string) *GoFile + func (f *GoFile) AddConst(c *ConstSpec) *GoFile + func (f *GoFile) AddElement(e FileElement) *GoFile + func (f *GoFile) AddType(t *TypeSpec) *GoFile + func (f *GoFile) AddVar(v *VarSpec) *GoFile + func (f *GoFile) ElementAt(i int) FileElement + func (f *GoFile) NumElements() int + func (f *GoFile) Package() Package + type ImportSpec struct + ImportPath string + PackageAlias string + func (i ImportSpec) String() string + type Imports struct + func NewImportsFor(pkgPath string) *Imports + func (i *Imports) EnsureAllTypesImported(s *Signature) *Signature + func (i *Imports) EnsureImported(sym Symbol) Symbol + func (i *Imports) EnsureTypeImported(n TypeName) TypeName + func (i *Imports) ImportSpecs() []ImportSpec + func (i *Imports) PrefixForPackage(importPath string) string + func (i *Imports) Qualify(sym Symbol) Symbol + func (i *Imports) QualifySignature(s *Signature) *Signature + func (i *Imports) QualifyTemplateData(data interface{}) interface{} + func (i *Imports) QualifyType(n TypeName) TypeName + func (i *Imports) RegisterImport(importPath, packageName string) string + func (i *Imports) RegisterImportForPackage(pkg Package) string + type InterfaceElement interface + type InterfaceEmbed struct + Comment string + Type Symbol + func NewInterfaceEmbed(s Symbol) *InterfaceEmbed + func (e *InterfaceEmbed) SetComment(comment string) *InterfaceEmbed + func (e *InterfaceEmbed) String() string + type InterfaceMethod struct + Comment string + Name string + func NewInterfaceMethod(name string) *InterfaceMethod + func (m *InterfaceMethod) AddArg(name string, t TypeName) *InterfaceMethod + func (m *InterfaceMethod) AddResult(name string, t TypeName) *InterfaceMethod + func (m *InterfaceMethod) SetComment(comment string) *InterfaceMethod + func (m *InterfaceMethod) SetVariadic(isVariadic bool) *InterfaceMethod + func (m *InterfaceMethod) String() string + func (m *InterfaceMethod) ToMethodRef() MethodReference + func (m *InterfaceMethod) ToTypeName() TypeName + type MethodReference struct + Method string + Type Symbol + func (r MethodReference) String() string + type MethodType struct + Name string + Signature Signature + type Package struct + ImportPath string + Name string + func NewPackage(importPath string) Package + func PackageForGoType(pkg *types.Package) Package + func (p Package) String() string + func (p Package) Symbol(name string) Symbol + type ReceiverSpec struct + IsPointer bool + Name string + Type string + func NewPointerReceiver(name, rcvrType string) *ReceiverSpec + func NewPointerReceiverForType(name string, rcvrType TypeNameOrSpec) *ReceiverSpec + func NewReceiver(name, rcvrType string) *ReceiverSpec + func NewReceiverForType(name string, rcvrType TypeNameOrSpec) *ReceiverSpec + type Signature struct + Args []ArgType + IsVariadic bool + Results []ArgType + func (s *Signature) AddArg(name string, t TypeName) *Signature + func (s *Signature) AddResult(name string, t TypeName) *Signature + func (s *Signature) SetVariadic(isVariadic bool) *Signature + type Symbol struct + Name string + Package Package + func NewSymbol(importPath, symName string) Symbol + func (s Symbol) String() string + type SymbolOrMethodRef interface + func SymbolForGoObject(obj types.Object) SymbolOrMethodRef + type TypeDecl struct + Comment string + Types []*TypeSpec + func NewTypeDecl(ts ...*TypeSpec) *TypeDecl + func (t *TypeDecl) AddType(ts *TypeSpec) *TypeDecl + func (t *TypeDecl) SetComment(comment string) *TypeDecl + type TypeKind int + const KindArray + const KindBasic + const KindChan + const KindFunc + const KindInterface + const KindInvalid + const KindMap + const KindNamed + const KindPtr + const KindSlice + const KindStruct + type TypeName interface + BasicKind func() reflect.Kind + Dir func() reflect.ChanDir + Elem func() TypeName + Embeds func() []Symbol + Fields func() []FieldType + Key func() TypeName + Kind func() TypeKind + Len func() int64 + Methods func() []MethodType + Signature func() *Signature + Symbol func() Symbol + func ArrayType(t TypeName, length int64) TypeName + func BasicType(k reflect.Kind) TypeName + func ChannelType(t TypeName, dir reflect.ChanDir) TypeName + func FuncType(args []ArgType, results []ArgType) TypeName + func FuncTypeFromSig(sig *Signature) TypeName + func FuncTypeVariadic(args []ArgType, results []ArgType) TypeName + func InterfaceType(embeds []Symbol, methods ...MethodType) TypeName + func MapType(k, v TypeName) TypeName + func NamedType(sym Symbol) TypeName + func PointerType(t TypeName) TypeName + func SliceType(t TypeName) TypeName + func StructType(fields ...FieldType) TypeName + func TypeNameForGoType(t types.Type) TypeName + func TypeNameForReflectType(t reflect.Type) TypeName + type TypeNameOrSpec interface + type TypeSpec struct + Comment string + Name string + func NewInterfaceTypeSpec(typeName string, elements ...InterfaceElement) *TypeSpec + func NewStructTypeSpec(typeName string, fields ...*FieldSpec) *TypeSpec + func NewTypeAlias(typeName string, t TypeNameOrSpec) *TypeSpec + func NewTypeSpec(typeName string, t TypeNameOrSpec) *TypeSpec + func (t *TypeSpec) IsAlias() bool + func (t *TypeSpec) SetComment(comment string) *TypeSpec + func (t *TypeSpec) String() string + func (t *TypeSpec) ToSymbol() Symbol + func (t *TypeSpec) ToTypeName() TypeName + func (t *TypeSpec) Underlying() TypeName + type VarDecl struct + Comment string + Vars []*VarSpec + func NewVarDecl(vs ...*VarSpec) *VarDecl + func (v *VarDecl) AddVar(vs *VarSpec) *VarDecl + func (v *VarDecl) SetComment(comment string) *VarDecl + type VarSpec struct + Comment string + Initializer *CodeBlock + Names []string + Type TypeNameOrSpec + func NewVar(names ...string) *VarSpec + func (v *VarSpec) Initialize(fmt string, args ...interface{}) *VarSpec + func (v *VarSpec) SetComment(comment string) *VarSpec + func (v *VarSpec) SetInitializer(cb *CodeBlock) *VarSpec + func (v *VarSpec) SetType(t TypeNameOrSpec) *VarSpec + func (v *VarSpec) String() string + func (v *VarSpec) SymbolAt(i int) Symbol + func (v *VarSpec) ToSymbol() Symbol