typex

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ConstrainUnderlying

func ConstrainUnderlying(params *types.TypeParamList, underlying types.Type) types.Type

func NewGoTypeFromReflectType

func NewGoTypeFromReflectType(t reflect.Type) types.Type

func NewPackage

func NewPackage(path string) *types.Package

func TypeByID

func TypeByID(id string) (t types.Type)

func TypeByImportAndName

func TypeByImportAndName(path, name string) types.Type

func Typename

func Typename(t Type) string

Types

type GoMethod

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

func (*GoMethod) Name

func (m *GoMethod) Name() string

func (*GoMethod) PkgPath

func (m *GoMethod) PkgPath() string

func (*GoMethod) Type

func (m *GoMethod) Type() Type

type GoStructField

type GoStructField struct {
	*types.Var
	// contains filtered or unexported fields
}

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

type GoType struct {
	Type types.Type
	// contains filtered or unexported fields
}

func NewGoType

func NewGoType(t types.Type) *GoType

func (*GoType) AssignableTo

func (t *GoType) AssignableTo(u Type) bool

func (*GoType) Comparable

func (t *GoType) Comparable() bool

func (*GoType) ConvertibleTo

func (t *GoType) ConvertibleTo(u Type) bool

func (*GoType) Elem

func (t *GoType) Elem() Type

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 (t *GoType) Implements(u Type) bool

func (*GoType) In

func (t *GoType) In(i int) Type

func (*GoType) IsVariadic

func (t *GoType) IsVariadic() bool

func (*GoType) Key

func (t *GoType) Key() Type

func (*GoType) Kind

func (t *GoType) Kind() reflect.Kind

func (*GoType) Len

func (t *GoType) Len() int

func (*GoType) Method

func (t *GoType) Method(i int) Method

func (*GoType) MethodByName

func (t *GoType) MethodByName(name string) (Method, bool)

func (*GoType) Name

func (t *GoType) Name() string

func (*GoType) NumField

func (t *GoType) NumField() int

func (*GoType) NumIn

func (t *GoType) NumIn() int

func (*GoType) NumMethod

func (t *GoType) NumMethod() int

func (*GoType) NumOut

func (t *GoType) NumOut() int

func (*GoType) Out

func (t *GoType) Out(i int) Type

func (*GoType) PkgPath

func (t *GoType) PkgPath() string

func (*GoType) String

func (t *GoType) String() string

func (*GoType) Unwrap

func (t *GoType) Unwrap() any

type Method

type Method interface {
	PkgPath() string
	Name() string
	Type() Type
}

type ReflectMethod

type ReflectMethod struct {
	Method reflect.Method
}

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 (*ReflectStructField) Type

func (f *ReflectStructField) Type() Type

type ReflectType

type ReflectType struct {
	reflect.Type
}

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 StructField interface {
	PkgPath() string
	Name() string
	Type() Type
	Tag() reflect.StructTag
	Anonymous() bool
}

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
}

func Deref

func Deref(t Type) Type

Jump to

Keyboard shortcuts

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