typesutil

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 12 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EachField

func EachField(typ Type, tagForName string, each func(field StructField, fieldDisplayName string, omitempty bool) bool, tagsForKeepingNested ...string)

func FieldDisplayName

func FieldDisplayName(structTag reflect.StructTag, namedTagKey string, defaultName string) (string, bool, bool)

func FullTypeName

func FullTypeName(typ Type) string

func NewPackage

func NewPackage(importPath string) *types.Package

func NewTypesTypeFromReflectType

func NewTypesTypeFromReflectType(rtype reflect.Type) types.Type

func TryNew

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

func TypeByName

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

Types

type Method

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

type RMethod

type RMethod struct {
	Method reflect.Method
}

func (*RMethod) Name

func (m *RMethod) Name() string

func (*RMethod) PkgPath

func (m *RMethod) PkgPath() string

func (*RMethod) Type

func (m *RMethod) Type() Type

type RStructField

type RStructField struct {
	StructField reflect.StructField
}

func (*RStructField) Anonymous

func (f *RStructField) Anonymous() bool

func (*RStructField) Name

func (f *RStructField) Name() string

func (*RStructField) PkgPath

func (f *RStructField) PkgPath() string

func (*RStructField) Tag

func (f *RStructField) Tag() reflect.StructTag

func (*RStructField) Type

func (f *RStructField) Type() Type

type RType

type RType struct {
	reflect.Type
}

func FromRType

func FromRType(rtype reflect.Type) *RType

func (*RType) AssignableTo

func (rtype *RType) AssignableTo(u Type) bool

func (*RType) ConvertibleTo

func (rtype *RType) ConvertibleTo(u Type) bool

func (*RType) Elem

func (rtype *RType) Elem() Type

func (*RType) Field

func (rtype *RType) Field(i int) StructField

func (*RType) FieldByName

func (rtype *RType) FieldByName(name string) (StructField, bool)

func (*RType) FieldByNameFunc

func (rtype *RType) FieldByNameFunc(match func(string) bool) (StructField, bool)

func (*RType) Implements

func (rtype *RType) Implements(u Type) bool

func (*RType) In

func (rtype *RType) In(i int) Type

func (*RType) Key

func (rtype *RType) Key() Type

func (*RType) Method

func (rtype *RType) Method(i int) Method

func (*RType) MethodByName

func (rtype *RType) MethodByName(name string) (Method, bool)

func (*RType) Out

func (rtype *RType) Out(i int) Type

type StructField

type StructField interface {
	PkgPath() string
	Name() string
	Tag() reflect.StructTag
	Type() Type
	Anonymous() bool
}

type TMethod

type TMethod struct {
	Ptr  bool
	Recv *TType
	Func *types.Func
}

func (*TMethod) Name

func (m *TMethod) Name() string

func (*TMethod) PkgPath

func (m *TMethod) PkgPath() string

func (*TMethod) Type

func (m *TMethod) Type() Type

type TStructField

type TStructField struct {
	*types.Var
	TagStr string
}

func (*TStructField) PkgPath

func (f *TStructField) PkgPath() string

func (*TStructField) Tag

func (f *TStructField) Tag() reflect.StructTag

func (*TStructField) Type

func (f *TStructField) Type() Type

type TType

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

func FromTType

func FromTType(ttype types.Type) *TType

func (*TType) AssignableTo

func (ttype *TType) AssignableTo(u Type) bool

func (*TType) Comparable

func (ttype *TType) Comparable() bool

func (*TType) ConvertibleTo

func (ttype *TType) ConvertibleTo(u Type) bool

func (*TType) Elem

func (ttype *TType) Elem() Type

func (*TType) Field

func (ttype *TType) Field(i int) StructField

func (*TType) FieldByName

func (ttype *TType) FieldByName(name string) (StructField, bool)

func (*TType) FieldByNameFunc

func (ttype *TType) FieldByNameFunc(match func(string) bool) (StructField, bool)

func (*TType) Implements

func (ttype *TType) Implements(u Type) bool

func (*TType) In

func (ttype *TType) In(i int) Type

func (*TType) Key

func (ttype *TType) Key() Type

func (*TType) Kind

func (ttype *TType) Kind() reflect.Kind

func (*TType) Len

func (ttype *TType) Len() int

func (*TType) Method

func (ttype *TType) Method(i int) Method

func (*TType) MethodByName

func (ttype *TType) MethodByName(name string) (Method, bool)

func (*TType) Name

func (ttype *TType) Name() string

func (*TType) NumField

func (ttype *TType) NumField() int

func (*TType) NumIn

func (ttype *TType) NumIn() int

func (*TType) NumMethod

func (ttype *TType) NumMethod() int

func (*TType) NumOut

func (ttype *TType) NumOut() int

func (*TType) Out

func (ttype *TType) Out(i int) Type

func (*TType) PkgPath

func (ttype *TType) PkgPath() string

func (*TType) String

func (ttype *TType) String() string

type Type

type Type interface {
	Name() string
	PkgPath() string
	String() string
	Kind() reflect.Kind
	Implements(u Type) bool
	AssignableTo(u Type) bool
	ConvertibleTo(u Type) bool
	Comparable() bool

	Key() Type
	Elem() Type
	Len() int

	NumField() int
	Field(i int) StructField
	FieldByName(name string) (StructField, bool)
	FieldByNameFunc(match func(string) bool) (StructField, bool)

	NumMethod() int
	Method(i int) Method
	MethodByName(name string) (Method, bool)

	NumIn() int
	In(i int) Type
	NumOut() int
	Out(i int) Type
}

interface like reflect.Type but only for data type

func Deref

func Deref(typ Type) Type

func EncodingTextMarshalerTypeReplacer

func EncodingTextMarshalerTypeReplacer(u Type) (Type, bool)

Directories

Path Synopsis
__fixtures__
typ

Jump to

Keyboard shortcuts

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