Documentation ¶
Index ¶
- func GetImportPathAndTypeNameFromTypesType(typesType types.Type) (string, string, string)
- type Attr
- type Command
- type CommandList
- func (list CommandList) ExistCommand(name string) bool
- func (list CommandList) ExistCommandAttr(name string, attr Attr) bool
- func (list CommandList) GetExtraTyp(parser *Parser) (extraTyp, extraTypWithPath string)
- func (list CommandList) GetJoinTyp(parser *Parser, pkgPath string, structs []Struct) (joinTyp, joinTypField, joinTypWithPath, joinTypFieldTyp string)
- type Field
- type ImportPathMap
- type Info
- func (info Info) GetImportPathAndTypeName(typesType types.Type) (string, string, string)
- func (info Info) GetNotEmptyImportPathMap() ImportPathMap
- func (info Info) GetTypNameWithPath(pkgImportPath string) string
- func (info Info) GetTypesTypeStructField(fieldName string) (typName string, typNameWithPath string)
- func (info *Info) InitWithTypes(name, pkgPath, doc, comment string, typ types.Type)
- type Option
- type Parser
- type Pkg
- type Struct
- type StructList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetImportPathAndTypeNameFromTypesType ¶ added in v0.5.0
GetImportPathAndTypeNameFromTypesType 从types.Type解析出导入路径、类型名称、带短路径的类型 获取带path类型 如从github.com/pkg/errors.Frame解析出errors.Frame 或从*github.com/pkg/errors.Frame解析出*errors.Frame 或从[]github.com/pkg/errors.Frame解析出[]errors.Frame 或从[4]github.com/pkg/errors.Frame解析出[4]errors.Frame 或从map[github.com/pkg/errors.Frame]github.com/pkg/errors.Frame解析出map[errors.Frame]errors.Frame
Types ¶
type Command ¶
type Command struct { Name string // 名称,如:list Attr Attr // 属性,如: column Extra string // 额外,如: deriveType }
Command 指令
type CommandList ¶
type CommandList []Command
CommandList 列表
func (CommandList) ExistCommand ¶
func (list CommandList) ExistCommand(name string) bool
ExistCommand 存在指令
func (CommandList) ExistCommandAttr ¶
func (list CommandList) ExistCommandAttr(name string, attr Attr) bool
ExistCommandAttr 存在指令
func (CommandList) GetExtraTyp ¶ added in v0.3.0
func (list CommandList) GetExtraTyp(parser *Parser) (extraTyp, extraTypWithPath string)
GetExtraTyp 获取额外信息
func (CommandList) GetJoinTyp ¶ added in v0.2.0
func (list CommandList) GetJoinTyp(parser *Parser, pkgPath string, structs []Struct) (joinTyp, joinTypField, joinTypWithPath, joinTypFieldTyp string)
GetJoinTyp 获取join类型信息
type ImportPathMap ¶
ImportPathMap 路径映射
func (ImportPathMap) MergeKey ¶
func (m ImportPathMap) MergeKey(om ImportPathMap) ImportPathMap
MergeKey 合并,如果有重复键,om里的值将会覆盖m的
type Info ¶
type Info struct { Name string // 名称,如:Info Anonymous bool // 是否匿名 // 可以使用这个字段来断言到具体的类型,如go/types.Struct TypesType types.Type // go/types.Type接口 // 如果是导入的第三方包,会包含包路径,如:github.com/pkg/errors.fundamental Type string // 类型,表面类型 // 如type Status int的底下类型就是int UnderType string // 底下类型 ImportPath string // 导入路径 TypName string // 类型名,如果是结构体则与Name相同,如果是字段,则是字段的类型 TypNameWithPath string // 带有导入路径的类型名称,如:parser.Info CanUseAsMapKey bool // 字段类型是否可作为map的键 Comment string // 注释 Doc string // 文档 Commands CommandList // 指令,如list, list column, list map, list slicemap等中的一个或多个 }
Info 信息
func (Info) GetImportPathAndTypeName ¶
GetImportPathAndTypeName 获取导入路径和类型名称
func (Info) GetNotEmptyImportPathMap ¶
func (info Info) GetNotEmptyImportPathMap() ImportPathMap
GetNotEmptyImportPathMap 获取非空导入路径映射
func (Info) GetTypNameWithPath ¶
GetTypNameWithPath 获取带路径类型名称
type StructList ¶ added in v0.2.0
type StructList []Struct
StructList 列表
func (StructList) Find ¶ added in v0.2.0
func (list StructList) Find(name string) Struct
Find 找出指定名称的结构体
func (StructList) FindField ¶ added in v0.2.0
func (list StructList) FindField(name, fieldName string) Field
FindField 找出指定结构体的指定字段