typesx

package
v1.1.0-rc9 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RtTextMarshaler = FromReflectType(reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem())

Functions

func ConstraintUnderlying

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

func EachField

func EachField(t Type, key string, each func(f StructField, display string, omitempty bool) bool, keepNestedTags ...string)

func FieldDisplayName

func FieldDisplayName(tag reflect.StructTag, key string, name string) (keyTag string, omitempty, exists bool)

func FullTypeName

func FullTypeName(t Type) string

func IsBasicReflectKind

func IsBasicReflectKind(k reflect.Kind) bool

func IsFloatReflectKind

func IsFloatReflectKind(k reflect.Kind) bool

func IsIntegerReflectKind

func IsIntegerReflectKind(k reflect.Kind) bool

func IsNumericReflectKind

func IsNumericReflectKind(k reflect.Kind) bool

func IsSignedIntReflectKind

func IsSignedIntReflectKind(k reflect.Kind) bool

func IsUnsignedIntReflectKind

func IsUnsignedIntReflectKind(k reflect.Kind) bool

func NewGoTypeFromReflectType

func NewGoTypeFromReflectType(t reflect.Type) types.Type

func NewPackage

func NewPackage(path string) *types.Package

func TryNew

func TryNew(u Type) (reflect.Value, bool)

func TypeByName

func TypeByName(path string, name string) types.Type

func TypeFor

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

func TypeString

func TypeString(t Type) string

Types

type GoMethod

type GoMethod struct {
	Ptr  bool
	Recv *GoType
	Func *types.Func
}

func MethodsOfGoType

func MethodsOfGoType(t types.Type) (methods []*GoMethod)

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
	TagValue string
}

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 FromGoType

func FromGoType(t types.Type) (gt *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 FromReflectType

func FromReflectType(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
	Tag() reflect.StructTag
	Type() Type
	Anonymous() bool
}

type Type

type Type interface {
	Unwrap() any

	Name() string
	PkgPath() 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

func EncodingTextMarshalerTypeReplacer

func EncodingTextMarshalerTypeReplacer(u Type) (Type, bool)

func PtrTo

func PtrTo(t Type) Type

Jump to

Keyboard shortcuts

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