Documentation
¶
Index ¶
Constants ¶
const ( TypeBool = SimpleType("bool") TypeInt = SimpleType("int") TypeFloat64 = SimpleType("float64") TypeString = SimpleType("string") TypeError = SimpleType("error") )
commonly-used types
Variables ¶
var (
ErrAmbiguousPackageName = errors.New("code: ambiguous package name")
)
Functions ¶
This section is empty.
Types ¶
type DuplicateInterfaceError ¶
type DuplicateInterfaceError string
func (DuplicateInterfaceError) Error ¶
func (err DuplicateInterfaceError) Error() string
type DuplicateStructError ¶
type DuplicateStructError string
func (DuplicateStructError) Error ¶
func (err DuplicateStructError) Error() string
type ExternalType ¶
ExternalType is a type that is called to another package
func (ExternalType) Code ¶
func (t ExternalType) Code() string
Code returns token string in code format
type File ¶
type File struct { PackageName string Imports []Import Structs []Struct Interfaces []InterfaceType }
File is a container of all required components for code generation in the file
func ExtractComponents ¶
ExtractComponents converts ast file into code components model
type InterfaceType ¶
InterfaceType is a definition of the interface
func (InterfaceType) Code ¶
func (intf InterfaceType) Code() string
Code returns token string in code format
type Package ¶
type Package struct { Name string Structs map[string]Struct Interfaces map[string]InterfaceType }
Package stores package name, struct and interface implementations as a result from ParsePackage.
type PointerType ¶
type PointerType struct {
ContainedType Type
}
PointerType is a model of pointer
func (PointerType) Code ¶
func (t PointerType) Code() string
Code returns token string in code format
func (PointerType) IsNumber ¶
func (t PointerType) IsNumber() bool
IsNumber returns IsNumber of its contained type
type SimpleType ¶
type SimpleType string
SimpleType is a type that can be called directly
func (SimpleType) IsNumber ¶
func (t SimpleType) IsNumber() bool
IsNumber returns true id a SimpleType is integer or float variants.
type Struct ¶
type Struct struct { Name string Fields StructFields }
Struct is a definition of the struct
func (Struct) ReferencedType ¶
ReferencedType returns a type variable of this struct
type StructField ¶
StructField is a definition of the struct field
type StructFields ¶
type StructFields []StructField
StructFields is a group of the StructField model
func (StructFields) ByName ¶
func (fields StructFields) ByName(name string) (StructField, bool)
ByName return struct field with matching name