reflector

package module
v0.0.1-dev Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 7 Imported by: 0

README

reflector

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsArray

func IsArray(typ Type) bool

func IsBasic

func IsBasic(typ Type) bool

func IsBoolean

func IsBoolean(typ Type) bool

func IsComplex

func IsComplex(typ Type) bool

func IsFloat

func IsFloat(typ Type) bool

func IsFunction

func IsFunction(typ Type) bool

func IsInstantiable

func IsInstantiable(typ Type) bool

func IsInteger

func IsInteger(typ Type) bool

func IsInterface

func IsInterface(typ Type) bool

func IsMap

func IsMap(typ Type) bool

func IsNumber

func IsNumber(typ Type) bool

func IsPointer

func IsPointer(typ Type) bool

func IsSignedInteger

func IsSignedInteger(typ Type) bool

func IsSlice

func IsSlice(typ Type) bool

func IsString

func IsString(typ Type) bool

func IsStruct

func IsStruct(typ Type) bool

func IsUnsignedInteger

func IsUnsignedInteger(typ Type) bool

Types

type Array

type Array interface {
	Type
	Instantiable
	Value() any
	Index(i int) any
	Set(i int, v any)
	Len() int
	Elem() Type
}

func ToArray

func ToArray(typ Type) (Array, bool)

type BitSize

type BitSize int
const (
	BitSize8   BitSize = 8
	BitSize16  BitSize = 16
	BitSize32  BitSize = 32
	BitSize64  BitSize = 64
	BitSize128 BitSize = 128
)

type Boolean

type Boolean interface {
	Type
	Instantiable
	CanSet() bool
	Value() (bool, error)
	SetValue(val bool) error
}

func ToBoolean

func ToBoolean(typ Type) (Boolean, bool)

type Chan

type Chan interface {
	Direction() ChanDirection
}

type ChanDirection

type ChanDirection int
const (
	SEND ChanDirection = 1 << iota
	RECEIVE
)

type Complex

type Complex interface {
	Type
	Instantiable
	BitSize() BitSize
	CanSet() bool
	Value() (complex128, error)
	SetValue(v complex128) error
	ImaginaryData() (float64, error)
	RealData() (float64, error)
	SetImaginaryData(val float64) error
	SetRealData(val float64) error
}

func ToComplex

func ToComplex(typ Type) (Complex, bool)

type Entry

type Entry interface {
	Key() any
	Value() any
}

type Field

type Field interface {
	Name() string
	IsExported() bool
	IsAnonymous() bool
	Type() Type
	CanSet() bool
	Value() (any, error)
	SetValue(value any) error
	Tags() Tags
}

type Float

type Float interface {
	Type
	Instantiable
	BitSize() BitSize
	CanSet() bool
	Value() (float64, error)
	SetValue(v float64) error
	Overflow(v float64) bool
}

func ToFloat

func ToFloat(typ Type) (Float, bool)

type Function

type Function interface {
	Type
	IsExported() bool
	Receiver() (Type, bool)
	HasReceiver() bool
	Parameters() []Type
	NumParameter() int
	Results() []Type
	NumResult() int
}

func ToFunction

func ToFunction(typ Type) (Function, bool)

type Instantiable

type Instantiable interface {
	Instantiate() Value
}

func ToInstantiable

func ToInstantiable(typ Type) (Instantiable, bool)

type Interface

type Interface interface {
	Type
	Methods() []Function
	NumMethod() int
}

func ToInterface

func ToInterface(typ Type) (Interface, bool)

type Map

type Map interface {
	Type
	Instantiable
	CanSet() bool
	Key() Type
	Value() Type
	Len() (int, error)
	Get(key any) (any, error)
	Put(key any, val any) error
	KeySet() ([]any, error)
	ValueSet() ([]any, error)
	EntrySet() []Entry
}

func ToMap

func ToMap(typ Type) (Map, bool)

type Pointer

type Pointer interface {
	Type
	Elem() Type
}

func ToPointer

func ToPointer(typ Type) (Pointer, bool)

type SignedInteger

type SignedInteger interface {
	Type
	Instantiable
	BitSize() BitSize
	CanSet() bool
	Value() (int64, error)
	SetValue(v int64) error
	Overflow(v int64) bool
}

func ToSignedInteger

func ToSignedInteger(typ Type) (SignedInteger, bool)

type Slice

type Slice interface {
	CanSet() bool
	Elem() Type
	Value() any
	Index(i int) any
	Len() int
	Append(values ...any)
}

func ToSlice

func ToSlice(typ Type) (Slice, bool)

type String

type String interface {
	Type
	Instantiable
	CanSet() bool
	Value() (string, error)
	SetValue(val string) error
}

func ToString

func ToString(typ Type) (String, bool)

type Struct

type Struct interface {
	Type
	Instantiable
	CanSet() bool
	Fields() []Field
	NumField() int
	Methods() []Function
	NumMethod() int
	Implements(i Interface) bool
}

func ToStruct

func ToStruct(typ Type) (Struct, bool)

type Tag

type Tag interface {
	Name() string
	Value() string
}

type Tags

type Tags []Tag

func (Tags) Contains

func (t Tags) Contains(name string) bool

func (Tags) Find

func (t Tags) Find(name string) (Tag, bool)

type Type

type Type interface {
	Name() string
	PackageName() string
	HasValue() bool
	Parent() Type
	ReflectType() reflect.Type
	ReflectValue() *reflect.Value
}

func TypeOf

func TypeOf[T any]() Type

func TypeOfAny

func TypeOfAny(obj any) Type

type UnsignedInteger

type UnsignedInteger interface {
	Type
	Instantiable
	BitSize() BitSize
	CanSet() bool
	Value() (uint64, error)
	SetValue(v uint64) error
	Overflow(v uint64) bool
}

func ToUnsignedInteger

func ToUnsignedInteger(typ Type) (UnsignedInteger, bool)

type Value

type Value interface {
	Val() any
	Elem() any
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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