udwGoParser

package
v0.0.0-...-f254aa5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 21 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoSourceRemoveCommentWithByte

func GoSourceRemoveCommentWithByte(in []byte) (out []byte)

func IsNameGoExport

func IsNameGoExport(name string) bool

func IsTypeEqual

func IsTypeEqual(t1 Type, t2 Type) bool

func IsTypeGoTimeObj

func IsTypeGoTimeObj(typ Type) bool

func MustWriteGoTypes

func MustWriteGoTypes(thisPackagePath string, typi Type) (s string, addPkgPathList []string)

func MustWriteMethodCall

func MustWriteMethodCall(req MethodCallWriteRequest) string

func OcSourceRemoveCommentWithByte

func OcSourceRemoveCommentWithByte(in []byte) (out []byte)

func QybPkgAllStructToMap

func QybPkgAllStructToMap(objectPkgPath string) map[string]string

func QybStructMethodInputAndOutputToMap

func QybStructMethodInputAndOutputToMap(pkgPath string, objectName string) map[string]string

func VisitNamedStruct

func VisitNamedStruct(req VisitNamedStructRequest)

Types

type ArrayType

type ArrayType struct {
	Size int
	Elem Type
}

func (*ArrayType) Equal

func (t *ArrayType) Equal(typ Type) bool

func (*ArrayType) GetElem

func (t *ArrayType) GetElem() Type

func (*ArrayType) GetKind

func (t *ArrayType) GetKind() Kind

func (*ArrayType) String

func (t *ArrayType) String() string

type BuiltinType

type BuiltinType string

func GetErrorType

func GetErrorType() BuiltinType

func GetStringType

func GetStringType() BuiltinType

func (BuiltinType) Equal

func (t BuiltinType) Equal(typ Type) bool

func (BuiltinType) GetElem

func (t BuiltinType) GetElem() Type

func (BuiltinType) GetKind

func (t BuiltinType) GetKind() Kind

func (BuiltinType) String

func (t BuiltinType) String() string

type ChanDir

type ChanDir int
const (
	RecvDir ChanDir = 1 << iota
	SendDir
	BothDir = RecvDir | SendDir
)

type ChanType

type ChanType struct {
	Dir  ChanDir
	Elem Type
}

func (*ChanType) Equal

func (t *ChanType) Equal(typ Type) bool

func (*ChanType) GetElem

func (t *ChanType) GetElem() Type

func (*ChanType) GetKind

func (t *ChanType) GetKind() Kind

func (*ChanType) String

func (t *ChanType) String() string

type FuncOrMethodDeclaration

type FuncOrMethodDeclaration struct {
	Name            string
	ReceiverVarName string
	ReceiverType    Type
	InParameter     []FuncParameter
	OutParameter    []FuncParameter
	IsVariadic      bool
}

func MustParseGoFunc

func MustParseGoFunc(s string) *FuncOrMethodDeclaration

func (*FuncOrMethodDeclaration) Clone

func (*FuncOrMethodDeclaration) Equal

func (t *FuncOrMethodDeclaration) Equal(typ Type) bool

func (*FuncOrMethodDeclaration) EqualMethod

func (t *FuncOrMethodDeclaration) EqualMethod(typ Type) bool

func (*FuncOrMethodDeclaration) GetElem

func (t *FuncOrMethodDeclaration) GetElem() Type

func (*FuncOrMethodDeclaration) GetInParameter

func (t *FuncOrMethodDeclaration) GetInParameter() []FuncParameter

func (*FuncOrMethodDeclaration) GetKind

func (t *FuncOrMethodDeclaration) GetKind() Kind

func (*FuncOrMethodDeclaration) GetName

func (t *FuncOrMethodDeclaration) GetName() string

func (*FuncOrMethodDeclaration) GetOutParameter

func (t *FuncOrMethodDeclaration) GetOutParameter() []FuncParameter

func (*FuncOrMethodDeclaration) HasInOrOutParameter

func (t *FuncOrMethodDeclaration) HasInOrOutParameter() bool

func (*FuncOrMethodDeclaration) IsExport

func (t *FuncOrMethodDeclaration) IsExport() bool

func (*FuncOrMethodDeclaration) SetName

func (t *FuncOrMethodDeclaration) SetName(name string)

func (*FuncOrMethodDeclaration) String

func (t *FuncOrMethodDeclaration) String() string

type FuncParameter

type FuncParameter struct {
	Name string
	Type Type
}

func (FuncParameter) GetName

func (p FuncParameter) GetName() string

func (FuncParameter) GetType

func (p FuncParameter) GetType() Type

type FuncType

type FuncType struct {
	InParameter  []FuncParameter
	OutParameter []FuncParameter
}

func (*FuncType) Equal

func (t *FuncType) Equal(typ Type) bool

func (*FuncType) GetElem

func (t *FuncType) GetElem() Type

func (*FuncType) GetKind

func (t *FuncType) GetKind() Kind

func (*FuncType) String

func (t *FuncType) String() string

type GoFileWriter

type GoFileWriter struct {
	Buf bytes.Buffer
	// contains filtered or unexported fields
}

func NewGoFileContext

func NewGoFileContext(PkgImportPath string) *GoFileWriter

func (*GoFileWriter) AddImportPath

func (gotpl *GoFileWriter) AddImportPath(importPath string)

func (*GoFileWriter) AddImportPathList

func (gotpl *GoFileWriter) AddImportPathList(importPathList []string)

func (*GoFileWriter) AddImportPathWithAlias

func (gotpl *GoFileWriter) AddImportPathWithAlias(importPath string, alias string)

func (*GoFileWriter) AddUnderScoreImportPath

func (gotpl *GoFileWriter) AddUnderScoreImportPath(importPath string)

func (*GoFileWriter) GetPkgImportPath

func (gotpl *GoFileWriter) GetPkgImportPath() string

func (*GoFileWriter) MergeFile

func (gotpl *GoFileWriter) MergeFile(gotpl1 *GoFileWriter) *GoFileWriter

func (*GoFileWriter) MustWriteFile

func (gotpl *GoFileWriter) MustWriteFile(_filepath string, body []byte)

func (*GoFileWriter) MustWriteFileWithSelfBuffer

func (gotpl *GoFileWriter) MustWriteFileWithSelfBuffer(_filepath string)

func (*GoFileWriter) MustWriteFuncOrMethodDecl

func (gotpl *GoFileWriter) MustWriteFuncOrMethodDecl(decl *FuncOrMethodDeclaration) string

func (*GoFileWriter) MustWriteGoTypePackagePrefix

func (gotpl *GoFileWriter) MustWriteGoTypePackagePrefix(pkgImportPath string) string

func (*GoFileWriter) MustWriteGoTypes

func (gotpl *GoFileWriter) MustWriteGoTypes(objTyp Type) string

func (*GoFileWriter) MustWriteNamedTypeDefine

func (gotpl *GoFileWriter) MustWriteNamedTypeDefine(namedType *NamedType) string

func (*GoFileWriter) SetBuildFlagContent

func (gotpl *GoFileWriter) SetBuildFlagContent(content string)

type InterfaceType

type InterfaceType struct {
}

func (InterfaceType) Equal

func (t InterfaceType) Equal(typ Type) bool

func (InterfaceType) GetElem

func (t InterfaceType) GetElem() Type

func (InterfaceType) GetKind

func (t InterfaceType) GetKind() Kind

func (InterfaceType) String

func (t InterfaceType) String() string

type Kind

type Kind uint
const (
	Invalid       Kind = 0
	Bool          Kind = 1
	Int           Kind = 2
	Int8          Kind = 3
	Int16         Kind = 4
	Int32         Kind = 5
	Int64         Kind = 6
	Uint          Kind = 7
	Uint8         Kind = 8
	Uint16        Kind = 9
	Uint32        Kind = 10
	Uint64        Kind = 11
	Uintptr       Kind = 12
	Float32       Kind = 13
	Float64       Kind = 14
	Complex64     Kind = 15
	Complex128    Kind = 16
	Array         Kind = 17
	Chan          Kind = 18
	Func          Kind = 19
	Interface     Kind = 20
	Map           Kind = 21
	Ptr           Kind = 22
	Slice         Kind = 23
	String        Kind = 24
	Struct        Kind = 25
	UnsafePointer Kind = 26
	Method        Kind = 27
	Named         Kind = 28
	DefinedFunc   Kind = 29
)

func (Kind) String

func (k Kind) String() string

type MapType

type MapType struct {
	Key   Type
	Value Type
}

func (*MapType) Equal

func (t *MapType) Equal(typ Type) bool

func (*MapType) GetElem

func (t *MapType) GetElem() Type

func (*MapType) GetKind

func (t *MapType) GetKind() Kind

func (*MapType) String

func (t *MapType) String() string

type MethodCallWriteRequest

type MethodCallWriteRequest struct {
	MethodExprString string
	InExprList       []string
	OutExprList      []string
	HasNewVarLeft    bool
}

type MustParseGoFuncDeclarationRequest

type MustParseGoFuncDeclarationRequest struct {
	Pkg                      *Package
	ImportList               []string
	GoFuncDeclarationContent string
}

type NamedType

type NamedType struct {
	PkgImportPath string
	Name          string
	UnderType     Type
	// contains filtered or unexported fields
}

func GetGoTimeType

func GetGoTimeType() *NamedType

func NewNamedType

func NewNamedType(PackagePath string, Name string) *NamedType

func (*NamedType) Equal

func (t *NamedType) Equal(typ Type) bool

func (*NamedType) GetElem

func (t *NamedType) GetElem() Type

func (*NamedType) GetKind

func (t *NamedType) GetKind() Kind

func (*NamedType) GetPackageName

func (t *NamedType) GetPackageName() string

func (*NamedType) GetUnderType

func (t *NamedType) GetUnderType() Type

func (*NamedType) String

func (t *NamedType) String() string

type Package

type Package struct {
	// contains filtered or unexported fields
}

func MustParsePackage

func MustParsePackage(gopath string, pkgPath string) *Package

func MustParsePackegeFromDefaultEnv

func MustParsePackegeFromDefaultEnv(pkgPath string) *Package

func (*Package) AddImport

func (pkg *Package) AddImport(pkgPath string)

func (*Package) GetAllMethodOnNamedType

func (pkg *Package) GetAllMethodOnNamedType(name string) (output []*FuncOrMethodDeclaration)

func (*Package) GetDirPath

func (pkg *Package) GetDirPath() string

func (*Package) GetFuncList

func (pkg *Package) GetFuncList() []*FuncOrMethodDeclaration

func (*Package) GetImportList

func (pkg *Package) GetImportList() []string

func (*Package) GetNamedTypeMethodSet

func (pkg *Package) GetNamedTypeMethodSet(typ *NamedType) (output []*FuncOrMethodDeclaration)

func (*Package) GetPkgImportPath

func (pkg *Package) GetPkgImportPath() string

func (*Package) IsInGoRoot

func (pkg *Package) IsInGoRoot() bool

func (*Package) IsMain

func (pkg *Package) IsMain() bool

func (*Package) LookupFunc

func (pkg *Package) LookupFunc(name string) *FuncOrMethodDeclaration

func (*Package) LookupNamedType

func (pkg *Package) LookupNamedType(name string) *NamedType

type PointerType

type PointerType struct {
	Elem Type
}

func NewPointer

func NewPointer(elem Type) *PointerType

func (*PointerType) Equal

func (t *PointerType) Equal(typ Type) bool

func (*PointerType) GetElem

func (t *PointerType) GetElem() Type

func (*PointerType) GetKind

func (t *PointerType) GetKind() Kind

func (*PointerType) String

func (t *PointerType) String() string

type Program

type Program struct {
	// contains filtered or unexported fields
}

func NewProgram

func NewProgram(lookupPathList []string) *Program

func NewProgramFromDefault

func NewProgramFromDefault() *Program

func (*Program) GetNamedType

func (prog *Program) GetNamedType(PkgImportPath string, name string) *NamedType

func (*Program) GetPackageByPkgImportPath

func (prog *Program) GetPackageByPkgImportPath(PkgImportPath string) *Package

func (*Program) GetPackageByPkgPath

func (prog *Program) GetPackageByPkgPath(pkgPath string) *Package

type SliceType

type SliceType struct {
	Elem Type
}

func (*SliceType) Equal

func (t *SliceType) Equal(typ Type) bool

func (*SliceType) GetElem

func (t *SliceType) GetElem() Type

func (*SliceType) GetKind

func (t *SliceType) GetKind() Kind

func (*SliceType) String

func (t *SliceType) String() string

type StructField

type StructField struct {
	Name             string
	Elem             Type
	IsAnonymousField bool
	Tag              string
}

func (StructField) Equal

func (sf StructField) Equal(sf2 StructField) bool

func (StructField) GetTagL1List

func (sf StructField) GetTagL1List() (outTagL1List []TagL1, errMsg string)

func (StructField) GetTagL1ValueByKeyIgnoreError

func (sf StructField) GetTagL1ValueByKeyIgnoreError(key string) string

func (StructField) IsExport

func (sf StructField) IsExport() bool

func (StructField) IsInTagList

func (sf StructField) IsInTagList(key string, search string) bool

type StructType

type StructType struct {
	Field []StructField
}

func GetEmptyStructType

func GetEmptyStructType() *StructType

func GetStructOrNamedStructFromType

func GetStructOrNamedStructFromType(elemT Type) *StructType

func (*StructType) Equal

func (t *StructType) Equal(typ Type) bool

func (*StructType) GetElem

func (t *StructType) GetElem() Type

func (*StructType) GetKind

func (t *StructType) GetKind() Kind

func (*StructType) IsEmpty

func (t *StructType) IsEmpty() bool

func (*StructType) String

func (t *StructType) String() string

type TagL1

type TagL1 struct {
	Key   string
	Value string
}

type Type

type Type interface {
	GetKind() Kind
	Equal(typ Type) bool

	String() string

	GetElem() Type
}

func GetFloat64Type

func GetFloat64Type() Type

type VisitNamedStructRequest

type VisitNamedStructRequest struct {
	Type                Type
	Fn                  func(namedTyp *NamedType)
	VisitNotExportField bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL