Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPointer(s string) (t string, p bool)
- func Contain(sourceStruct *SourceStruct, i *ImportStruct) bool
- func FunctionNameLineNum(lines []*FuncLine) int
- func FunctionReceiverLineNum(lines []*FuncLine) int
- func SourcePrettyText(sources []*SourceStruct) string
- type Double
- type FuncLine
- type FuncStruct
- type ImportStruct
- type ParamStruct
- type ParamStructType
- type ReceiverStruct
- type ReturnType
- type Single
- type Skip
- type SkipHolder
- type SourceStruct
Constants ¶
View Source
const ( ReceiverLine = 1 << 1 FunctionNameLine = 1 << 2 )
Variables ¶
View Source
var ParamTypes = map[string]ParamStructType{
"struct": structFunc,
"slice": sliceFunc,
"array": arrayFunc,
"map": mapFunc,
"func": funcFunc,
"interface": interfaceFunc,
"chan": chanFunc,
}
View Source
var ReturnNameMap = map[ReturnType]string{ StructReturn: "struct", SliceReturn: "slice", ArrayReturn: "array", MapReturn: "map", FuncReturn: "func", InterFaceReturn: "interface", ChanReturn: "chan", }
Functions ¶
func CheckPointer ¶
func Contain ¶
func Contain(sourceStruct *SourceStruct, i *ImportStruct) bool
func FunctionNameLineNum ¶
func FunctionReceiverLineNum ¶
func SourcePrettyText ¶
func SourcePrettyText( sources []*SourceStruct) string
Types ¶
type FuncStruct ¶
type FuncStruct struct { FuncString string Receiver *ReceiverStruct FuncName string FuncLine int FuncEndLine int Params []*ParamStruct ReturnLine int Returns []ReturnType NameLine int LineString []*FuncLine }
func NewFuncStruct ¶
func NewFuncStruct(name string, line *int) *FuncStruct
type ImportStruct ¶
type ImportStruct struct { ImportTag string ImportString string ImportEndTerm string SourceTag string SourceContain bool }
func ImportCopy ¶
func ImportCopy(imports []*ImportStruct) (result []*ImportStruct)
func ImportStr ¶
func ImportStr(str string) *ImportStruct
type ParamStruct ¶
type ParamStruct struct { Pointer bool Name string ParamType string StructType ParamStructType }
type ParamStructType ¶
type ParamStructType func(str string) (param *ParamStruct)
func GetTypeStruct ¶
func GetTypeStruct(t string) ParamStructType
type ReceiverStruct ¶
type ReturnType ¶
type ReturnType int
const ( StructReturn ReturnType SliceReturn ArrayReturn MapReturn FuncReturn InterFaceReturn ChanReturn )
type SkipHolder ¶
type SkipHolder struct {
Skip
}
func (*SkipHolder) NeedSkip ¶
func (h *SkipHolder) NeedSkip(r rune) bool
type SourceStruct ¶
type SourceStruct struct { Path string XgcPath string PackageStr string Imports []*ImportStruct Funcs []*FuncStruct InjectImport func(sourceStruct *SourceStruct, imports []*ImportStruct) ImportLine int FileLine int }
func NewSourceStruct ¶
func NewSourceStruct(path string) *SourceStruct
func SourceParse ¶
func SourceParse(sourceFile string) *SourceStruct
Click to show internal directories.
Click to hide internal directories.