Documentation
¶
Overview ¶
Currently this code is unused I still don't know to use my own decls data type here but I created this file
Index ¶
- type AbstractCode
- type AbstractCodeImpl
- func (a *AbstractCodeImpl) AddArgsToCallExpr(funcName null.String, callerSpec CallerSpec)
- func (a *AbstractCodeImpl) AddCommentOutsideFunction(commentSpec Comment)
- func (a *AbstractCodeImpl) AddFuncWireBuild(funcName string)
- func (a *AbstractCodeImpl) AddFunction(functionSpecs FunctionSpecList)
- func (a *AbstractCodeImpl) AddFunctionArgs(functionSpec FunctionSpec)
- func (a *AbstractCodeImpl) AddFunctionArgsToReturn(functionReturnArgs FunctionReturnArgsSpec)
- func (a *AbstractCodeImpl) AddFunctionCaller(funcName string, callerSpec CallerSpec)
- func (a *AbstractCodeImpl) AddGlobalVariables()
- func (a *AbstractCodeImpl) AddImport(importSpec ImportSpec)
- func (a *AbstractCodeImpl) AddInterfaceFuncDecl() error
- func (a *AbstractCodeImpl) AddInterfaces(interfaceSpecs InterfaceSpecList)
- func (a *AbstractCodeImpl) AddStructVarDecl(structArgs StructArgList)
- func (a *AbstractCodeImpl) AddStructs(structSpecs StructSpecList)
- func (a *AbstractCodeImpl) AddWireDependencyInjection(wireDependency WireDependencyInjection)
- func (a *AbstractCodeImpl) GetCode() string
- func (a AbstractCodeImpl) GetPackageName() string
- func (a *AbstractCodeImpl) RebuildCode() error
- type CallerArg
- type CallerArgBasicLit
- type CallerArgIdent
- type CallerArgList
- type CallerArgSelectorStmt
- type CallerFunc
- type CallerSelecterExpr
- type CallerSpec
- type Comment
- type CustomDtypes
- type CustomDtypesProp
- type DataTypes
- type FunctionArg
- type FunctionArgList
- type FunctionBodySpec
- type FunctionReturnArgsSpec
- type FunctionReturnSpec
- type FunctionReturnSpecList
- type FunctionSpec
- type FunctionSpecList
- type FunctionStructSpec
- type ImportSpec
- type ImportSpecList
- type InterfaceDtypes
- type InterfaceMethod
- type InterfaceMethodArg
- type InterfaceMethodArgList
- type InterfaceMethodList
- type InterfaceSpec
- type InterfaceSpecList
- type StructArg
- type StructArgList
- type StructDtypes
- type StructSpec
- type StructSpecList
- type WireDependencyInjection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractCode ¶
type AbstractCode interface { GetCode() string GetPackageName() string AddImport(importSpec ImportSpec) AddInterfaces(interfaceSpecs InterfaceSpecList) AddInterfaceFuncDecl() error AddStructs(structSpecs StructSpecList) AddStructVarDecl(structArgs StructArgList) AddWireDependencyInjection(wireDependency WireDependencyInjection) AddGlobalVariables() AddFunction(functionSpecs FunctionSpecList) AddFunctionArgs(functionSpec FunctionSpec) AddFunctionCaller(funcName string, callerSpec CallerSpec) AddArgsToCallExpr(funcName null.String, callerSpec CallerSpec) AddFunctionArgsToReturn(functionReturnArgs FunctionReturnArgsSpec) AddCommentOutsideFunction(commentSpec Comment) RebuildCode() error }
func NewAbstractCode ¶
func NewAbstractCode(code string, parserMode parser.Mode) AbstractCode
type AbstractCodeImpl ¶
type AbstractCodeImpl struct {
// contains filtered or unexported fields
}
func (*AbstractCodeImpl) AddArgsToCallExpr ¶
func (a *AbstractCodeImpl) AddArgsToCallExpr(funcName null.String, callerSpec CallerSpec)
func (*AbstractCodeImpl) AddCommentOutsideFunction ¶
func (a *AbstractCodeImpl) AddCommentOutsideFunction(commentSpec Comment)
func (*AbstractCodeImpl) AddFuncWireBuild ¶
func (a *AbstractCodeImpl) AddFuncWireBuild(funcName string)
func (*AbstractCodeImpl) AddFunction ¶
func (a *AbstractCodeImpl) AddFunction(functionSpecs FunctionSpecList)
func (*AbstractCodeImpl) AddFunctionArgs ¶
func (a *AbstractCodeImpl) AddFunctionArgs(functionSpec FunctionSpec)
func (*AbstractCodeImpl) AddFunctionArgsToReturn ¶
func (a *AbstractCodeImpl) AddFunctionArgsToReturn(functionReturnArgs FunctionReturnArgsSpec)
func (*AbstractCodeImpl) AddFunctionCaller ¶
func (a *AbstractCodeImpl) AddFunctionCaller(funcName string, callerSpec CallerSpec)
func (*AbstractCodeImpl) AddGlobalVariables ¶
func (a *AbstractCodeImpl) AddGlobalVariables()
func (*AbstractCodeImpl) AddImport ¶
func (a *AbstractCodeImpl) AddImport(importSpec ImportSpec)
func (*AbstractCodeImpl) AddInterfaceFuncDecl ¶
func (a *AbstractCodeImpl) AddInterfaceFuncDecl() error
func (*AbstractCodeImpl) AddInterfaces ¶
func (a *AbstractCodeImpl) AddInterfaces(interfaceSpecs InterfaceSpecList)
func (*AbstractCodeImpl) AddStructVarDecl ¶
func (a *AbstractCodeImpl) AddStructVarDecl(structArgs StructArgList)
func (*AbstractCodeImpl) AddStructs ¶
func (a *AbstractCodeImpl) AddStructs(structSpecs StructSpecList)
func (*AbstractCodeImpl) AddWireDependencyInjection ¶
func (a *AbstractCodeImpl) AddWireDependencyInjection(wireDependency WireDependencyInjection)
AddWireDependencyInjection add this thing like this var productRepo = wire.NewSet(
productrepo.NewRepository, wire.Bind( new(productrepo.Repositories), new(*productrepo.RepositoriesImpl), ),
)
func InitHttpProtocol() *http.HttpImpl { wire.Build( productRepo, <-- and append to here ) return &http.HttpImpl{} }
TODO: should make the function more globaly
func (*AbstractCodeImpl) GetCode ¶
func (a *AbstractCodeImpl) GetCode() string
func (AbstractCodeImpl) GetPackageName ¶
func (a AbstractCodeImpl) GetPackageName() string
func (*AbstractCodeImpl) RebuildCode ¶
func (a *AbstractCodeImpl) RebuildCode() error
type CallerArg ¶
type CallerArg struct { SelectorStmt *CallerArgSelectorStmt BasicLit *CallerArgBasicLit Ident *CallerArgIdent }
type CallerArgBasicLit ¶
type CallerArgIdent ¶
type CallerArgIdent struct {
Name string
}
type CallerArgList ¶
type CallerArgList []*CallerArg
type CallerArgSelectorStmt ¶
type CallerFunc ¶
type CallerFunc struct { // Func here has 2 object // first is name and the second is selector // the Name means the name of the library and the selector is the function // example we have fmt.Println. the fmt means the Name and the Println means the selector Name CallerSelecterExpr Selector string }
type CallerSelecterExpr ¶
type CallerSpec ¶
type CallerSpec struct { Func CallerFunc Args CallerArgList }
type CustomDtypes ¶
type CustomDtypes CustomDtypesProp
type CustomDtypesProp ¶
type FunctionArg ¶
type FunctionArgList ¶
type FunctionArgList []*FunctionArg
type FunctionBodySpec ¶
type FunctionBodySpec struct { }
type FunctionReturnArgsSpec ¶
type FunctionReturnArgsSpec struct { IsPointer bool // FuncName means the name of the function // example // func NewHttp(), so the FuncName = NewHttp FuncName string // ReturnName means the name of return // example // return &Http{}, so the return name is Http ReturnName string // DataTypeKey name of the data type that we want to inject DataTypeKey string // DataTypeValue name of the data type that we want to inject DataTypeValue string }
type FunctionReturnSpec ¶
type FunctionReturnSpec struct { IsPointer bool // IsStruct define that the return is a struct, if the IsStruct is false // so it define it an error IsStruct bool LibName string DataType string // Return define the variable name that will be returned // example // func a() interface{} { // var a := interface{} // return a <- a here means Return name // } Return string }
FunctionReturnSpec currently only be able to return a custom struct and an error. it cannot return a number or anythink
type FunctionReturnSpecList ¶
type FunctionReturnSpecList []*FunctionReturnSpec
type FunctionSpec ¶
type FunctionSpec struct { Name string // StructName define that the function is a method of an object StructSpec *FunctionStructSpec Args FunctionArgList Returns *FunctionReturnSpecList Body FunctionBodySpec }
type FunctionSpecList ¶
type FunctionSpecList []*FunctionSpec
type FunctionStructSpec ¶
type ImportSpec ¶
type ImportSpecList ¶
type ImportSpecList []*ImportSpec
type InterfaceDtypes ¶
type InterfaceDtypes string
func (InterfaceDtypes) String ¶
func (i InterfaceDtypes) String() string
type InterfaceMethod ¶
type InterfaceMethod struct { Name string Args InterfaceMethodArgList }
type InterfaceMethodArg ¶
type InterfaceMethodArgList ¶
type InterfaceMethodArgList []*InterfaceMethodArg
type InterfaceMethodList ¶
type InterfaceMethodList []*InterfaceMethod
type InterfaceSpec ¶
type InterfaceSpecList ¶
type InterfaceSpecList []*InterfaceSpec
type StructArg ¶
type StructArg struct { StructName string Name string DataType StructDtypes IsPointer bool }
type StructArgList ¶
type StructArgList []*StructArg
type StructDtypes ¶
type StructSpec ¶
type StructSpecList ¶
type StructSpecList []*StructSpec
Click to show internal directories.
Click to hide internal directories.