Documentation ¶
Index ¶
- func Assign(vars ...string) *declarationValues
- func Declare(vars ...string) *declarationValues
- func Err() *identifierValue
- func FuncCall(name string) *funcCallValue
- func Identifier(name string) *identifierValue
- func If(val Value) *ifStmt
- func IfDecl(declare *declarationStmt, val Value) *ifStmt
- func Import(path string) *importLine
- func ImportAlias(path, alias string) *importLine
- func InitStruct(structName string) *structValue
- func Int(intVal int) *identifierValue
- func Lambda() *lambdaValue
- func Len(val Value) *goFuncValue
- func Nil() *identifierValue
- func QualFuncCall(alias, name string) *funcCallValue
- func QualIdentifier(alias, name string) *identifierValue
- func QualThis(alias, typeName string) *thisDecl
- func String(strValue string) *identifierValue
- func This(typeName string) *thisDecl
- type Block
- type File
- func (f *File) CommentF(format string, args ...interface{}) *File
- func (f *File) DeclareVars(vars ...*VarValue) Block
- func (f *File) Func(name string) *funcBlock
- func (f *File) GenerateGetter(this *thisDecl, fieldName string, returnType *ReturnTypeDecl)
- func (f *File) GoString() string
- func (f *File) Imports(imports ...*importLine) *importsBlock
- func (f *File) Interface(interfaceName string) *interfaceBlock
- func (f *File) Method(this *thisDecl, name string) *methodBlock
- func (f *File) QualType(typeName, alias, baseType string) *typeBlock
- func (f *File) Save(filePath string) error
- func (f *File) Struct(structName string) *structBlock
- func (f *File) Type(typeName, baseType string) *typeBlock
- type FuncDeclaration
- type ParamDecl
- type PropertyDecl
- type ReturnTypeDecl
- type Stmt
- type StructPropertyValue
- type Value
- type VarValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assign ¶ added in v0.0.7
func Assign(vars ...string) *declarationValues
Assign creates a new assignment statement without variable values (will not compile). In order to assign values call `Values()`
func Declare ¶
func Declare(vars ...string) *declarationValues
Declare creates a new declaration statement without variable values (will not compile). In order to assign values call `Values()`
func Identifier ¶
func Identifier(name string) *identifierValue
Identifier creates a new identifier (variable, value, etc.)
func IfDecl ¶ added in v0.0.5
func IfDecl(declare *declarationStmt, val Value) *ifStmt
Creates a new if statement with variable declaration
func Import ¶
func Import(path string) *importLine
Import creates a new import statemet without an alias
func ImportAlias ¶
func ImportAlias(path, alias string) *importLine
ImportAlias creates a new import statement with an alias
func InitStruct ¶ added in v0.0.6
func InitStruct(structName string) *structValue
InitStruct creates a new struct initialisation
func Lambda ¶ added in v0.0.10
func Lambda() *lambdaValue
Lambda creates a new lambda function value
func Len ¶
func Len(val Value) *goFuncValue
Len creates a new function call of the Go build-in function `len()`
func QualFuncCall ¶
func QualFuncCall(alias, name string) *funcCallValue
QualFuncCall creates a new function call with a package alias
func QualIdentifier ¶
func QualIdentifier(alias, name string) *identifierValue
Identifier creates a new identifier with a package alias (variable, value, etc.)
func QualThis ¶
func QualThis(alias, typeName string) *thisDecl
QualThis creates a new this-parameter for a method with a package alias
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) DeclareVars ¶ added in v0.0.9
DeclareVars creates a new variable declaration block
func (*File) GenerateGetter ¶
func (f *File) GenerateGetter(this *thisDecl, fieldName string, returnType *ReturnTypeDecl)
GenerateGetter creates a public getter method according to the field
func (*File) Imports ¶
func (f *File) Imports(imports ...*importLine) *importsBlock
Imports creates a new imports block
type FuncDeclaration ¶ added in v0.0.8
type FuncDeclaration struct {
// contains filtered or unexported fields
}
func FuncDecl ¶ added in v0.0.8
func FuncDecl(funcName string) *FuncDeclaration
FuncDecl creates a new function declaration
func (*FuncDeclaration) Params ¶ added in v0.0.8
func (f *FuncDeclaration) Params(params ...*ParamDecl) *FuncDeclaration
Params adds parameters to the function declaration
func (*FuncDeclaration) ReturnTypes ¶ added in v0.0.8
func (f *FuncDeclaration) ReturnTypes(returnTypes ...*ReturnTypeDecl) *FuncDeclaration
ReturnTypes adds return types to the function declaration
type ParamDecl ¶ added in v0.0.7
type ParamDecl struct {
// contains filtered or unexported fields
}
type PropertyDecl ¶ added in v0.0.8
type PropertyDecl struct {
// contains filtered or unexported fields
}
func EmbeddedProperty ¶ added in v0.0.9
func EmbeddedProperty(typeName string) *PropertyDecl
EmbeddedProp crates a new embedded property
func Property ¶ added in v0.0.8
func Property(propertyName, typeName string) *PropertyDecl
Property creates a new property declaration
func QualEmbeddedProperty ¶ added in v0.0.9
func QualEmbeddedProperty(alias, typeName string) *PropertyDecl
QualEmbeddedProperty creates a new embedded property with a package alias
func QualProperty ¶ added in v0.0.8
func QualProperty(propertyName, alias, typeName string) *PropertyDecl
QualProperty creates a new property declaration with a package alias
func (*PropertyDecl) Pointer ¶ added in v0.0.8
func (p *PropertyDecl) Pointer() *PropertyDecl
Pointer turns the property into a pointer type
type ReturnTypeDecl ¶ added in v0.0.5
type ReturnTypeDecl struct {
// contains filtered or unexported fields
}
func QualReturnType ¶
func QualReturnType(alias, name string) *ReturnTypeDecl
QualReturnType creates a new return type with an alias of an imported package
func ReturnType ¶
func ReturnType(name string) *ReturnTypeDecl
ReturnType creates a new return type for a function
func ReturnTypeError ¶
func ReturnTypeError() *ReturnTypeDecl
ReturnTypeError create a new return type of type `error`
func (*ReturnTypeDecl) Pointer ¶ added in v0.0.5
func (r *ReturnTypeDecl) Pointer() *ReturnTypeDecl
Pointer turns the return type into a pointer value
type Stmt ¶ added in v0.0.3
type Stmt interface {
// contains filtered or unexported methods
}
func DeclareVars ¶ added in v0.0.5
DeclareVars creates a new variable declaration statement
type StructPropertyValue ¶ added in v0.0.6
type StructPropertyValue struct {
// contains filtered or unexported fields
}
func PropValue ¶ added in v0.0.6
func PropValue(propertyName string, propertyValue Value) *StructPropertyValue
PropValue creates a new property with its value
Source Files ¶
- block_comment.go
- block_func.go
- block_funcParam.go
- block_funcReturnType.go
- block_import.go
- block_interface.go
- block_interfaceFunc.go
- block_method.go
- block_methodThis.go
- block_package.go
- block_struct.go
- block_structProp.go
- block_type.go
- help_name.go
- helper_call.go
- main_assign.go
- main_file.go
- main_interfaces.go
- stmt_declare.go
- stmt_declareVars.go
- stmt_defer.go
- stmt_if.go
- stmt_return.go
- stmt_utils.go
- util_getter.go
- util_sb.go
- value_call.go
- value_equals.go
- value_field.go
- value_funcCall.go
- value_goFunc.go
- value_identifier.go
- value_lambda.go
- value_struct.go
- value_utils.go