Documentation
¶
Index ¶
- Variables
- func ConstrainUnderlying(params *types.TypeParamList, underlying types.Type) types.Type
- func NewGoTypeFromReflectType(t reflect.Type) types.Type
- func NewPackage(path string) *types.Package
- func TypeByID(id string) (t types.Type)
- func TypeByImportAndName(path, name string) types.Type
- func Typename(t Type) string
- type GoMethod
- type GoStructField
- type GoType
- func (t *GoType) AssignableTo(u Type) bool
- func (t *GoType) Comparable() bool
- func (t *GoType) ConvertibleTo(u Type) bool
- func (t *GoType) Elem() Type
- func (t *GoType) Field(i int) StructField
- func (t *GoType) FieldByName(name string) (StructField, bool)
- func (t *GoType) FieldByNameFunc(match func(string) bool) (StructField, bool)
- func (t *GoType) Implements(u Type) bool
- func (t *GoType) In(i int) Type
- func (t *GoType) IsVariadic() bool
- func (t *GoType) Key() Type
- func (t *GoType) Kind() reflect.Kind
- func (t *GoType) Len() int
- func (t *GoType) Method(i int) Method
- func (t *GoType) MethodByName(name string) (Method, bool)
- func (t *GoType) Name() string
- func (t *GoType) NumField() int
- func (t *GoType) NumIn() int
- func (t *GoType) NumMethod() int
- func (t *GoType) NumOut() int
- func (t *GoType) Out(i int) Type
- func (t *GoType) PkgPath() string
- func (t *GoType) String() string
- func (t *GoType) Unwrap() any
- type Method
- type ReflectMethod
- type ReflectStructField
- type ReflectType
- func (t *ReflectType) AssignableTo(u Type) bool
- func (t *ReflectType) ConvertibleTo(u Type) bool
- func (t *ReflectType) Elem() Type
- func (t *ReflectType) Field(i int) StructField
- func (t *ReflectType) FieldByName(name string) (StructField, bool)
- func (t *ReflectType) FieldByNameFunc(match func(string) bool) (StructField, bool)
- func (t *ReflectType) Implements(u Type) bool
- func (t *ReflectType) In(i int) Type
- func (t *ReflectType) Key() Type
- func (t *ReflectType) Method(i int) Method
- func (t *ReflectType) MethodByName(name string) (Method, bool)
- func (t *ReflectType) Out(i int) Type
- func (t *ReflectType) String() string
- func (t *ReflectType) Unwrap() any
- type StructField
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LoadFiles = packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles LoadImports = LoadFiles | packages.NeedImports LoadTypes = LoadImports | packages.NeedTypes | packages.NeedTypesSizes )
View Source
var ReflectKindToTypesKind = map[reflect.Kind]types.BasicKind{ reflect.Bool: types.Bool, reflect.Int: types.Int, reflect.Int8: types.Int8, reflect.Int16: types.Int16, reflect.Int32: types.Int32, reflect.Int64: types.Int64, reflect.Uint: types.Uint, reflect.Uint8: types.Uint8, reflect.Uint16: types.Uint16, reflect.Uint32: types.Uint32, reflect.Uint64: types.Uint64, reflect.Uintptr: types.Uintptr, reflect.Float32: types.Float32, reflect.Float64: types.Float64, reflect.Complex64: types.Complex64, reflect.Complex128: types.Complex128, reflect.String: types.String, reflect.UnsafePointer: types.UnsafePointer, }
View Source
var TypesKindToReflectKind = map[types.BasicKind]reflect.Kind{ types.Bool: reflect.Bool, types.Int: reflect.Int, types.Int8: reflect.Int8, types.Int16: reflect.Int16, types.Int32: reflect.Int32, types.Int64: reflect.Int64, types.Uint: reflect.Uint, types.Uint8: reflect.Uint8, types.Uint16: reflect.Uint16, types.Uint32: reflect.Uint32, types.Uint64: reflect.Uint64, types.Uintptr: reflect.Uintptr, types.Float32: reflect.Float32, types.Float64: reflect.Float64, types.Complex64: reflect.Complex64, types.Complex128: reflect.Complex128, types.String: reflect.String, types.UnsafePointer: reflect.UnsafePointer, types.UntypedBool: reflect.Bool, types.UntypedInt: reflect.Int, types.UntypedRune: reflect.Int32, types.UntypedFloat: reflect.Float32, types.UntypedComplex: reflect.Complex64, types.UntypedString: reflect.String, }
Functions ¶
func ConstrainUnderlying ¶
func NewPackage ¶
func TypeByImportAndName ¶
Types ¶
type GoStructField ¶
func (*GoStructField) PkgPath ¶
func (f *GoStructField) PkgPath() string
func (*GoStructField) Tag ¶
func (f *GoStructField) Tag() reflect.StructTag
func (*GoStructField) Type ¶
func (f *GoStructField) Type() Type
type GoType ¶
func (*GoType) AssignableTo ¶
func (*GoType) Comparable ¶
func (*GoType) ConvertibleTo ¶
func (*GoType) Field ¶
func (t *GoType) Field(i int) StructField
func (*GoType) FieldByName ¶
func (t *GoType) FieldByName(name string) (StructField, bool)
func (*GoType) FieldByNameFunc ¶
func (t *GoType) FieldByNameFunc(match func(string) bool) (StructField, bool)
func (*GoType) Implements ¶
func (*GoType) IsVariadic ¶
type ReflectMethod ¶
func (*ReflectMethod) Name ¶
func (m *ReflectMethod) Name() string
func (*ReflectMethod) PkgPath ¶
func (m *ReflectMethod) PkgPath() string
func (*ReflectMethod) Type ¶
func (m *ReflectMethod) Type() Type
type ReflectStructField ¶
type ReflectStructField struct {
StructField reflect.StructField
}
func (*ReflectStructField) Anonymous ¶
func (f *ReflectStructField) Anonymous() bool
func (*ReflectStructField) Name ¶
func (f *ReflectStructField) Name() string
func (*ReflectStructField) PkgPath ¶
func (f *ReflectStructField) PkgPath() string
func (*ReflectStructField) Tag ¶
func (f *ReflectStructField) Tag() reflect.StructTag
func (*ReflectStructField) Type ¶
func (f *ReflectStructField) Type() Type
type ReflectType ¶
func NewReflectType ¶
func NewReflectType(t reflect.Type) *ReflectType
func (*ReflectType) AssignableTo ¶
func (t *ReflectType) AssignableTo(u Type) bool
func (*ReflectType) ConvertibleTo ¶
func (t *ReflectType) ConvertibleTo(u Type) bool
func (*ReflectType) Elem ¶
func (t *ReflectType) Elem() Type
func (*ReflectType) Field ¶
func (t *ReflectType) Field(i int) StructField
func (*ReflectType) FieldByName ¶
func (t *ReflectType) FieldByName(name string) (StructField, bool)
func (*ReflectType) FieldByNameFunc ¶
func (t *ReflectType) FieldByNameFunc(match func(string) bool) (StructField, bool)
func (*ReflectType) Implements ¶
func (t *ReflectType) Implements(u Type) bool
func (*ReflectType) In ¶
func (t *ReflectType) In(i int) Type
func (*ReflectType) Key ¶
func (t *ReflectType) Key() Type
func (*ReflectType) Method ¶
func (t *ReflectType) Method(i int) Method
func (*ReflectType) MethodByName ¶
func (t *ReflectType) MethodByName(name string) (Method, bool)
func (*ReflectType) Out ¶
func (t *ReflectType) Out(i int) Type
func (*ReflectType) String ¶
func (t *ReflectType) String() string
func (*ReflectType) Unwrap ¶
func (t *ReflectType) Unwrap() any
type StructField ¶
type Type ¶
type Type interface {
// Unwrap to types.Type or reflect.Type
Unwrap() any
PkgPath() string
Name() string
String() string
Kind() reflect.Kind
Implements(Type) bool
AssignableTo(Type) bool
ConvertibleTo(Type) bool
Comparable() bool
Key() Type
Elem() Type
Len() int
NumField() int
Field(int) StructField
FieldByName(string) (StructField, bool)
FieldByNameFunc(func(string) bool) (StructField, bool)
NumMethod() int
Method(int) Method
MethodByName(string) (Method, bool)
IsVariadic() bool
NumIn() int
In(int) Type
NumOut() int
Out(int) Type
}
Click to show internal directories.
Click to hide internal directories.