Documentation
¶
Index ¶
- func Copy(dst, src Value) int
- func DeepEqual(x, y interface{}) bool
- func Swapper(slice interface{}) func(i, j int)
- type Kind
- type MapIter
- type SliceHeader
- type StringHeader
- type StructField
- type StructTag
- type Type
- func (t Type) Align() int
- func (t Type) AssignableTo(u Type) bool
- func (t Type) Bits() int
- func (t Type) Comparable() bool
- func (t Type) ConvertibleTo(u Type) bool
- func (t Type) Elem() Type
- func (t Type) Field(i int) StructField
- func (t Type) FieldAlign() int
- func (t Type) Implements(u Type) bool
- func (t Type) Key() Type
- func (t Type) Kind() Kind
- func (t Type) Len() int
- func (t Type) Name() string
- func (t Type) NumField() int
- func (t Type) NumMethod() int
- func (t Type) Size() uintptr
- func (t Type) String() string
- type TypeError
- type Value
- func (v Value) Addr() Value
- func (v Value) Bool() bool
- func (v Value) Bytes() []byte
- func (v Value) CanAddr() bool
- func (v Value) CanInterface() bool
- func (v Value) CanSet() bool
- func (v Value) Cap() int
- func (v Value) Complex() complex128
- func (v Value) Convert(t Type) Value
- func (v Value) Elem() Value
- func (v Value) Field(i int) Value
- func (v Value) FieldByIndex(index []int) Value
- func (v Value) FieldByName(name string) Value
- func (v Value) Float() float64
- func (v Value) Index(i int) Value
- func (v Value) Int() int64
- func (v Value) Interface() interface{}
- func (v Value) IsNil() bool
- func (v Value) IsValid() bool
- func (v Value) Kind() Kind
- func (v Value) Len() int
- func (v Value) MapIndex(key Value) Value
- func (v Value) MapKeys() []Value
- func (v Value) MapRange() *MapIter
- func (v Value) NumField() int
- func (v Value) OverflowInt(x int64) bool
- func (v Value) OverflowUint(x uint64) bool
- func (v Value) Pointer() uintptr
- func (v Value) Set(x Value)
- func (v Value) SetBool(x bool)
- func (v Value) SetComplex(x complex128)
- func (v Value) SetFloat(x float64)
- func (v Value) SetInt(x int64)
- func (v Value) SetMapIndex(key, elem Value)
- func (v Value) SetString(x string)
- func (v Value) SetUint(x uint64)
- func (v Value) Slice(i, j int) Value
- func (v Value) String() string
- func (v Value) Type() Type
- func (v Value) Uint() uint64
- type ValueError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Kind ¶
type Kind uintptr
const ( Invalid Kind = iota Bool Int Int8 Int16 Int32 Int64 Uint Uint8 Uint16 Uint32 Uint64 Uintptr Float32 Float64 Complex64 Complex128 String UnsafePointer Chan Interface Ptr Slice Array Func Map Struct )
Copied from reflect/type.go https://golang.org/src/reflect/type.go?s=8302:8316#L217
type SliceHeader ¶
type StringHeader ¶
type StructField ¶
type StructField struct { // Name indicates the field name. Name string // PkgPath is the package path where the struct containing this field is // declared for unexported fields, or the empty string for exported fields. PkgPath string Type Type Tag StructTag // field tag string Anonymous bool Offset uintptr }
A StructField describes a single field in a struct.
type StructTag ¶ added in v0.14.0
type StructTag string
A StructTag is the tag string in a struct field.
type Type ¶
type Type uintptr
The typecode as used in an interface{}.
func (Type) Align ¶ added in v0.8.0
Align returns the alignment of this type. It is similar to calling unsafe.Alignof.
func (Type) AssignableTo ¶ added in v0.8.0
AssignableTo returns whether a value of type u can be assigned to a variable of type t.
func (Type) Bits ¶
Bits returns the number of bits that this type uses. It is only valid for arithmetic types (integers, floats, and complex numbers). For other types, it will panic.
func (Type) Comparable ¶ added in v0.8.0
Comparable returns whether values of this type can be compared to each other.
func (Type) ConvertibleTo ¶ added in v0.14.0
func (Type) Elem ¶
Elem returns the element type for channel, slice and array types, the pointed-to value for pointer types, and the key type for map types.
func (Type) Field ¶
func (t Type) Field(i int) StructField
Field returns the type of the i'th field of this struct type. It panics if t is not a struct type.
func (Type) FieldAlign ¶ added in v0.8.0
FieldAlign returns the alignment if this type is used in a struct field. It is currently an alias for Align() but this might change in the future.
func (Type) Implements ¶ added in v0.9.0
func (Type) Len ¶
Len returns the number of elements in this array. It panics of the type kind is not Array.
func (Type) NumField ¶
NumField returns the number of fields of a struct type. It panics for other type kinds.
type TypeError ¶ added in v0.8.0
type TypeError struct {
Method string
}
TypeError is the error that is used in a panic when invoking a method on a type that is not applicable to that type.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
func Append ¶ added in v0.14.0
Append appends the values x to a slice s and returns the resulting slice. As in Go, each x's value must be assignable to the slice's element type.
func (Value) CanInterface ¶
func (Value) Cap ¶
Cap returns the capacity of this value for arrays, channels and slices. For other types, it panics.
func (Value) Complex ¶
func (v Value) Complex() complex128
func (Value) FieldByIndex ¶ added in v0.14.0
FieldByIndex returns the nested field corresponding to index.
func (Value) FieldByName ¶ added in v0.14.0
func (Value) IsNil ¶
IsNil returns whether the value is the nil value. It panics if the value Kind is not a channel, map, pointer, function, slice, or interface.
func (Value) Len ¶
Len returns the length of this value for slices, strings, arrays, channels, and maps. For other types, it panics.
func (Value) NumField ¶
NumField returns the number of fields of this struct. It panics for other value types.
func (Value) OverflowInt ¶ added in v0.14.0
func (Value) OverflowUint ¶ added in v0.14.0
func (Value) Pointer ¶
Pointer returns the underlying pointer of the given value for the following types: chan, map, pointer, unsafe.Pointer, slice, func.
func (Value) SetComplex ¶
func (v Value) SetComplex(x complex128)
func (Value) SetMapIndex ¶ added in v0.14.0
type ValueError ¶
type ValueError struct {
Method string
}
func (*ValueError) Error ¶
func (e *ValueError) Error() string