xreflect

package
v0.0.0-...-f54e8e0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MPL-2.0 Imports: 14 Imported by: 1

README

xreflect

The package xreflect is a wrapper aroung Go standard packages reflect and go/types that emulates the missing features of reflect package:

  • NamedOf: declare new named types at runtime
  • AddMethod: add method to a named type at runtime
  • InterfaceOf: declare new interfaces at runtime

License

MPL v2.0+

Documentation

Index

Constants

View Source
const (
	StrGensymInterface = "\U0001202A" // name of extra struct field needed by the interpreter when creating interpreted interfaces
	StrGensymPrivate   = "\U00012038" // prefix to generate names for unexported struct fields.
	StrGensymAnonymous = "\U00012039" // prefix to generate names for anonymous struct fields.
)

the following constants must match with github.com/cosmos72/gomacro/base/constants.go

View Source
const MaxDepth = int(^uint(0) >> 1)

Variables

View Source
var ConstrainedInterfaceReceiverType genericV2InterfaceReceiverType
View Source
var ReflectBasicTypes = rbasictypes

Functions

func FromEmulatedInterface

func FromEmulatedInterface(v Value) (Value, Type)

extract the concrete value and type contained in an emulated interface

func GensymAnonymous

func GensymAnonymous(name string) string

func GensymPrivate

func GensymPrivate(name string) string

func IsEmulatedInterface

func IsEmulatedInterface(t Type) bool

func IsGoUntypedKind

func IsGoUntypedKind(gkind types.BasicKind) bool

func QLess

func QLess(p, q QName) bool

func ReflectUnderlying

func ReflectUnderlying(rtype r.Type) r.Type

best-effort implementation of missing reflect.Type.Underlying()

func ToBasicKind

func ToBasicKind(kind r.Kind, untyped bool) types.BasicKind

func ToReflectKind

func ToReflectKind(gkind types.BasicKind) r.Kind

func ToReflectValues

func ToReflectValues(v []Value) []r.Value

Types

type Error

type Error struct {
	Type Type
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

type Forward

type Forward interface{}

type Importer

type Importer struct {
	// converts from go/types to github.com/cosmos72/gomacro/go/types
	Converter types.Converter
	// contains filtered or unexported fields
}

func DefaultImporter

func DefaultImporter() *Importer

func (*Importer) Import

func (imp *Importer) Import(path string) (*types.Package, error)

func (*Importer) ImportFrom

func (imp *Importer) ImportFrom(path string, srcDir string, mode gotypes.ImportMode) (*types.Package, error)

type InterfaceHeader

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

InterfaceHeader is the internal header of interpreted interfaces

func MakeInterfaceHeader

func MakeInterfaceHeader(val Value, typ Type) InterfaceHeader

func (InterfaceHeader) Type

func (h InterfaceHeader) Type() Type

func (InterfaceHeader) Value

func (h InterfaceHeader) Value() Value

type Key

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

Key is a Type wrapper suitable for use with operator == and as map[T1]T2 key

func MakeKey

func MakeKey(t Type) Key

func (Key) Type

func (k Key) Type() Type

type Kind

type Kind = r.Kind

re-export reflect.Kind from this package

const (
	Invalid       Kind = r.Invalid
	Bool          Kind = r.Bool
	Int           Kind = r.Int
	Int8          Kind = r.Int8
	Int16         Kind = r.Int16
	Int32         Kind = r.Int32
	Int64         Kind = r.Int64
	Uint          Kind = r.Uint
	Uint8         Kind = r.Uint8
	Uint16        Kind = r.Uint16
	Uint32        Kind = r.Uint32
	Uint64        Kind = r.Uint64
	Uintptr       Kind = r.Uintptr
	Float32       Kind = r.Float32
	Float64       Kind = r.Float64
	Complex64     Kind = r.Complex64
	Complex128    Kind = r.Complex128
	Array         Kind = r.Array
	Chan          Kind = r.Chan
	Func          Kind = r.Func
	Interface     Kind = r.Interface
	Map           Kind = r.Map
	Ptr           Kind = r.Ptr
	Slice         Kind = r.Slice
	String        Kind = r.String
	Struct        Kind = r.Struct
	UnsafePointer Kind = r.UnsafePointer
)

type Method

type Method struct {
	Name       string
	Pkg        *Package
	Type       Type        // method type
	Funs       *[]r.Value  // (*Funs)[Index] is the method, with receiver as first argument
	Index      int         // index for Type.Method
	FieldIndex []int       // embedded fields index sequence for r.Type.FieldByIndex or r.Value.FieldByIndex
	GoFun      *types.Func // for completeness
}

func MissingMethod

func MissingMethod(t, tinterf Type) *Method

return one of the methods defined by interface tinterf but missing from t

func (Method) String

func (m Method) String() string

return detailed string representation of a method signature, including its receiver if present

type Option

type Option uint8
const (
	OptDefault Option = iota
	// type is approximate because it's self-recursive
	// or part of a recursive cycle
	OptRecursive
	// type is still being defined
	OptIncomplete
)

func (Option) String

func (o Option) String() string

type Package

type Package types.Package

func (*Package) GoPackage

func (pkg *Package) GoPackage() *types.Package

func (*Package) Name

func (pkg *Package) Name() string

func (*Package) Path

func (pkg *Package) Path() string

type QName

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

QName is a replacement for go/types.Id and implements accurate comparison of type names, field names and method names. It recognizes unexported names, and names declared in different packages.

To compare two names, build two QNames with the functions QName* then compare the two QName structs with ==

func QName1

func QName1(q QNameI) QName

func QName2

func QName2(name, pkgpath string) QName

func QNameGo

func QNameGo(obj types.Object) QName

func QNameGo2

func QNameGo2(name string, pkg *types.Package) QName

func (QName) Name

func (q QName) Name() string

func (QName) PkgPath

func (q QName) PkgPath() string

func (QName) String

func (q QName) String() string

type QNameI

type QNameI interface {
	Name() string
	PkgPath() string
}

type QNameI_github_com_cosmos72_gomacro_xreflect

type QNameI_github_com_cosmos72_gomacro_xreflect struct {
	Object   interface{}
	Name_    func() string
	PkgPath_ func() string
}

--------------- proxy for github.com/cosmos72/gomacro/xreflect.QNameI ---------------

func (*QNameI_github_com_cosmos72_gomacro_xreflect) Name

func (*QNameI_github_com_cosmos72_gomacro_xreflect) PkgPath

type SelectCase

type SelectCase = r.SelectCase

type SelectDir

type SelectDir = r.SelectDir

re-export reflect.SelectDir from this package

const (
	SelectSend    SelectDir = r.SelectSend
	SelectRecv    SelectDir = r.SelectRecv
	SelectDefault SelectDir = r.SelectDefault
)

type StructField

type StructField struct {
	// Name is the field name. If empty, it will be computed from Type name, and Anonymous will be set to true
	Name string
	// Pkg is the package that qualifies a lower case (unexported)
	// field name. It may be nil for upper case (exported) field names.
	// See https://golang.org/ref/spec#Uniqueness_of_identifiers
	Pkg       *Package
	Type      Type        // field type
	Tag       r.StructTag // field tag string
	Offset    uintptr     // offset within struct, in bytes. meaningful only if all Deref[] are false
	Index     []int       // index sequence for r.Type.FieldByIndex or r.Value.FieldByIndex
	Anonymous bool        // is an embedded field. If true, Name should be empty or equal to the type's name
}

type Type

type Type func(z) *xtype

Type:s must be compared with IdenticalTo, not with == produce compile-time error on == between Type:s but allow comparison with nil

func (Type) AddMethod

func (t Type) AddMethod(name string, signature Type) int

AddMethod adds method with given name and signature to type, unless it is already in the method list. It panics if the type is unnamed, or if the signature is not a function-with-receiver type. Returns the method index, or < 0 in case of errors

func (Type) Align

func (t Type) Align() int

Align returns the alignment in bytes of a value of this type when allocated in memory.

func (Type) AssignableTo

func (t Type) AssignableTo(u Type) bool

AssignableTo reports whether a value of the type is assignable to type u.

func (Type) Bits

func (t Type) Bits() int

Bits returns the size of the type in bits. It panics if the type's Kind is not one of the sized or unsized Int, Uint, Float, or Complex kinds.

func (Type) ChanDir

func (t Type) ChanDir() r.ChanDir

ChanDir returns a channel type's direction. It panics if the type's Kind is not Chan.

func (Type) Comparable

func (t Type) Comparable() bool

Comparable reports whether values of this type are comparable.

func (Type) Complete

func (t Type) Complete() Type

Complete marks an interface type as complete and computes wrapper methods for embedded fields. It must be called by users of InterfaceOf after the interface's embedded types are fully defined and before using the interface type in any way other than to form other types. Complete returns the receiver.

func (Type) ConvertibleTo

func (t Type) ConvertibleTo(u Type) bool

ConvertibleTo reports whether a value of the type is convertible to type u.

func (Type) Elem

func (t Type) Elem() Type

Elem returns a type's element type. It panics if the type's Kind is not Array, Chan, Map, Ptr, or Slice.

func (Type) Field

func (t Type) Field(i int) StructField

Field returns a struct type's i-th field. It panics if the type's Kind is not Struct. It panics if i is not in the range [0, NumField()).

func (Type) FieldAlign

func (t Type) FieldAlign() int

FieldAlign returns the alignment in bytes of a value of this type when used as a field in a struct.

func (Type) FieldByName

func (t Type) FieldByName(name, pkgpath string) (field StructField, count int)

FieldByName returns the (possibly embedded) struct field with the given name and the number of fields found at the same (shallowest) depth: 0 if not found. Private fields are returned only if they were declared in pkgpath.

func (Type) GetMethods

func (t Type) GetMethods() *[]r.Value

GetMethods returns the pointer to the method values. It panics if the type is unnamed

func (Type) GetUserData

func (t Type) GetUserData(key interface{}) (interface{}, bool)

GetUserData returns the user-supplied data of the type.

func (Type) GoType

func (t Type) GoType() types.Type

GoType returns the go/types.Type corresponding to the given type.

func (Type) IdenticalTo

func (t Type) IdenticalTo(u Type) bool

Identical reports whether the type is identical to type u.

func (Type) Implements

func (t Type) Implements(u Type) bool

Implements reports whether the type implements the interface type u. It panics if u's Kind is not Interface

func (Type) In

func (t Type) In(i int) Type

In returns the type of a function type's i'th input parameter. It panics if the type's Kind is not Func. It panics if i is not in the range [0, NumIn()).

func (Type) IsMethod

func (t Type) IsMethod() bool

IsMethod reports whether a function type's contains a receiver, i.e. is a method. If IsMethod returns true, the actual receiver type is available as the first parameter, i.e. Type.In(0) It panics if the type's Kind is not Func.

func (Type) IsVariadic

func (t Type) IsVariadic() bool

IsVariadic reports whether a function type's final input parameter is a "..." parameter. If so, t.In(t.NumIn() - 1) returns the parameter's implicit actual type []T. IsVariadic panics if the type's Kind is not Func.

func (Type) Key

func (t Type) Key() Type

Key returns a map type's key type. It panics if the type's Kind is not Map.

func (Type) Kind

func (t Type) Kind() r.Kind

Kind returns the specific kind of the type.

func (Type) Len

func (t Type) Len() int

Len returns an array type's length. It panics if the type's Kind is not Array.

func (Type) Method

func (t Type) Method(i int) Method

For interfaces, Method returns the i-th method, including methods from embedded interfaces. For all other named types, Method returns the i-th explicitly declared method, ignoring wrapper methods for embedded fields. It panics if i is outside the range 0 .. NumMethod()-1

func (Type) MethodByName

func (t Type) MethodByName(name, pkgpath string) (method Method, count int)

MethodByName returns the method with given name (including wrapper methods for embedded fields) and the number of methods found at the same (shallowest) depth: 0 if not found. Private methods are returned only if they were declared in pkgpath.

func (Type) Name

func (t Type) Name() string

Name returns the type's name within its package. It returns an empty string for unnamed types.

func (Type) Named

func (t Type) Named() bool

Named returns whether the type is named. It returns false for unnamed types.

func (Type) NumAllMethod

func (t Type) NumAllMethod() int

NumAllMethod returns the *total* number of methods for interface or named type t, including wrapper methods for embedded fields or embedded interfaces. Note: it has slightly different semantics from go/types.(*Named).NumMethods(),

since the latter returns 0 for named interfaces, and callers need to manually invoke
goNamedType.Underlying().NumMethods() to retrieve the number of methods
of a named interface

func (Type) NumExplicitMethod

func (t Type) NumExplicitMethod() int

NumExplicitMethod returns the number of explicitly declared methods of named type or interface t. Wrapper methods for embedded fields or embedded interfaces are not counted.

func (Type) NumField

func (t Type) NumField() int

NumField returns a struct type's field count. It panics if the type's Kind is not Struct.

func (Type) NumIn

func (t Type) NumIn() int

NumIn returns a function type's input parameter count. It panics if the type's Kind is not Func.

func (Type) NumMethod

func (t Type) NumMethod() int

For interfaces, NumMethod returns *total* number of methods for interface t, including wrapper methods for embedded interfaces. For all other named types, NumMethod returns the number of explicitly declared methods, ignoring wrapper methods for embedded fields. Returns 0 for other unnamed types.

func (Type) NumOut

func (t Type) NumOut() int

NumOut returns a function type's output parameter count. It panics if the type's Kind is not Func.

func (Type) Out

func (t Type) Out(i int) Type

Out returns the type of a function type's i'th output parameter. It panics if the type's Kind is not Func. It panics if i is not in the range [0, NumOut()).

func (Type) Pkg

func (t Type) Pkg() *Package

Pkg returns a named type's package, that is, the package where it was defined. If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), Pkg will return nil.

func (Type) PkgName

func (t Type) PkgName() string

PkgName returns a named type's package name, that is, the default name that the package provides when imported. If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), the package name will be the empty string.

func (Type) PkgPath

func (t Type) PkgPath() string

PkgPath returns a named type's package path, that is, the import path that uniquely identifies the package, such as "encoding/base64". If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), the package path will be the empty string.

func (Type) ReflectType

func (t Type) ReflectType() r.Type

ReflectType returns a best-effort reflect.Type that approximates the type. It may be inexact for the following reasons:

  1. missing reflect.NamedOf(): no way to programmatically create named types, or to access the underlying type of a named type
  2. missing reflect.InterfaceOf(): interface types created at runtime will be approximated by structs
  3. missing reflect.MethodOf(): method types created at runtime will be approximated by functions whose first parameter is the receiver
  4. reflect.StructOf() does not support embedded or unexported fields
  5. go/reflect lacks the ability to create self-referencing types: references to the type itself will be replaced by interface{}.

Examples:

after invoking at runtime type2.NewStruct() and type2.NewNamed()
to create the following type:
    type List struct { Elem int; Rest *List }
ReflectType will return a reflect.Type equivalent to:
    struct { Elem int; Rest interface{} }
i.e. the type name will be missing due to limitation 1 above,
and the field 'Rest' will have type interface{} instead of *List due to limitation 5.

func (Type) Resolve

func (t Type) Resolve() Type

if t.ReflectType() is Forward i.e. unknown/approximated due to recursive types, try to resolve it

func (Type) SetUnderlying

func (t Type) SetUnderlying(underlying Type)

SetUnderlying sets the underlying type of a named type and marks it as complete. It panics if the type is unnamed, or if the underlying type is named, or if SetUnderlying() was already invoked on the named type.

func (Type) SetUserData

func (t Type) SetUserData(key, value interface{})

SetUserData sets the user-supplied data of the type.

func (Type) Size

func (t Type) Size() uintptr

Size returns the number of bytes needed to store a value of the given type; it is analogous to unsafe.Sizeof.

func (Type) String

func (t Type) String() string

String returns a string representation of a type.

func (Type) Universe

func (t Type) Universe() *Universe

func (Type) UnsafeForceReflectType

func (t Type) UnsafeForceReflectType(rtype r.Type)

type Types

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

type Universe

type Universe struct {
	// map types.Type -> Type
	Types

	ReflectTypes    map[r.Type]Type
	BasicTypes      []Type
	TypeOfInterface Type
	TypeOfForward   Type
	TypeOfError     Type
	TryResolve      func(name, pkgpath string) Type
	Packages        map[string]*Package
	Importer        *Importer
	RebuildDepth    int
	DebugDepth      int

	ThreadSafe bool
	// contains filtered or unexported fields
}

func NewUniverse

func NewUniverse() *Universe

func (*Universe) ArrayOf

func (v *Universe) ArrayOf(count int, elem Type) Type

func (*Universe) CachePackage

func (v *Universe) CachePackage(pkg *types.Package)

CachePackage unconditionally adds pkg to Universe.Packages, then also adds its imports if not cached already

func (*Universe) ChanOf

func (v *Universe) ChanOf(dir r.ChanDir, elem Type) Type

func (*Universe) FromReflectType

func (v *Universe) FromReflectType(rtype r.Type) Type

FromReflectType creates a Type corresponding to given reflect.Type Note: conversions from Type to reflect.Type and back are not exact, for the reasons listed in Type.ReflectType() Conversions from reflect.Type to Type and back are not exact for the same reasons.

func (*Universe) FuncOf

func (v *Universe) FuncOf(in []Type, out []Type, variadic bool) Type

func (*Universe) InterfaceOf

func (v *Universe) InterfaceOf(pkg *Package, methodnames []string, methodtypes []Type, embeddeds []Type) Type

InterfaceOf returns a new interface for the given methods and embedded types. After the methods and embeddeds are fully defined, call Complete() to mark the interface as complete and compute wrapper methods for embedded fields.

unexported method names are created in 'pkg'.

WARNING: the Type returned by InterfaceOf is not complete, i.e. its method set is not computed yet. Once you know that methods and embedded interfaces are complete, call Complete() to compute the method set and mark this Type as complete.

func (*Universe) InvalidateCache

func (v *Universe) InvalidateCache()

clears all xtype.cache.field and xtype.cache.method. invoked by NamedOf() when a type is redefined.

func (*Universe) InvalidateMethodCache

func (v *Universe) InvalidateMethodCache()

clears all xtype.cache.method. invoked by AddMethod() when a method is redefined.

func (*Universe) LoadPackage

func (v *Universe) LoadPackage(path string) *Package

func (*Universe) MakeType

func (v *Universe) MakeType(gtype types.Type, rtype r.Type, opt Option) Type

func (*Universe) MapOf

func (v *Universe) MapOf(key, elem Type) Type

func (*Universe) MethodOf

func (v *Universe) MethodOf(recv Type, in []Type, out []Type, variadic bool) Type

func (*Universe) NamedOf

func (v *Universe) NamedOf(name, pkgpath string) Type

NamedOf returns a new named type for the given type name and package. Initially, the underlying type may be set to interface{} - use SetUnderlying to change it. These two steps are separate to allow creating self-referencing types, as for example type List struct { Elem int; Rest *List }

func (*Universe) PtrTo

func (v *Universe) PtrTo(elem Type) Type

func (*Universe) SliceOf

func (v *Universe) SliceOf(elem Type) Type

func (*Universe) StructOf

func (v *Universe) StructOf(fields []StructField) Type

func (*Universe) TypeOf

func (v *Universe) TypeOf(rvalue interface{}) Type

TypeOf creates a Type corresponding to reflect.TypeOf() of given value. Note: conversions from Type to reflect.Type and back are not exact, because of the reasons listed in Type.ReflectType() Conversions from reflect.Type to Type and back are not exact for the same reasons.

func (*Universe) VisitFields

func (v *Universe) VisitFields(t Type, visitor func(StructField))

visit type's direct and embedded fields in breadth-first order

type Value

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

xreflect.Value is a replacement for reflect.Value that hides the presence of xreflect.Forward due to emulated recursive types

func Append

func Append(s Value, x ...Value) Value

func EmulatedInterfaceGetMethod

func EmulatedInterfaceGetMethod(obj Value, index int) Value

extract the already-made i-th closure from inside the emulated interface object.

func FromReflectValues

func FromReflectValues(rv []r.Value) []Value

func MakeChan

func MakeChan(t Type, n int) Value

func MakeFunc

func MakeFunc(t Type, fn func([]Value) []Value) Value

func MakeMap

func MakeMap(t Type) Value

func MakeMapWithSize

func MakeMapWithSize(t Type, n int) Value

func MakeSlice

func MakeSlice(t Type, len, cap int) Value

func MakeValue

func MakeValue(rv r.Value) Value

func New

func New(t Type) Value

func NewR

func NewR(rt r.Type) Value

func Select

func Select(cases []SelectCase) (chosen int, recv Value, ok bool)

func ToEmulatedInterface

func ToEmulatedInterface(rtypeinterf r.Type, v Value, t Type, obj2methods []func(Value) Value) Value

create an emulated interface from given value, type and method extractors (methods extractors are functions that, given a value, return one of its methods)

func ValueOf

func ValueOf(x interface{}) Value

func Zero

func Zero(t Type) Value

Zero returns a Value representing the zero value for the specified xreflect.Type.

func ZeroR

func ZeroR(typ r.Type) Value

Zero returns a Value representing the zero value for the specified reflect.Type.

func (Value) Addr

func (v Value) Addr() Value

func (Value) Bool

func (v Value) Bool() bool

func (Value) Bytes

func (v Value) Bytes() []byte

func (Value) Call

func (v Value) Call(in []Value) []Value

func (Value) CallSlice

func (v Value) CallSlice(in []Value) []Value

func (Value) CanAddr

func (v Value) CanAddr() bool

func (Value) CanInterface

func (v Value) CanInterface() bool

func (Value) CanSet

func (v Value) CanSet() bool

func (Value) Cap

func (v Value) Cap() int

func (Value) Close

func (v Value) Close()

func (Value) Complex

func (v Value) Complex() complex128

func (Value) Convert

func (v Value) Convert(rt r.Type) Value

func (Value) Elem

func (v Value) Elem() Value

func (Value) Field

func (v Value) Field(i int) Value

func (Value) FieldByIndex

func (v Value) FieldByIndex(index []int) Value

func (Value) FieldByName

func (v Value) FieldByName(name string) Value

func (Value) FieldByNameFunc

func (v Value) FieldByNameFunc(match func(string) bool) Value

func (Value) Float

func (v Value) Float() float64

func (Value) Index

func (v Value) Index(i int) Value

func (Value) Int

func (v Value) Int() int64

func (Value) Interface

func (v Value) Interface() interface{}

func (Value) InterfaceData

func (v Value) InterfaceData() [2]uintptr

func (Value) IsNil

func (v Value) IsNil() bool

func (Value) IsValid

func (v Value) IsValid() bool

func (Value) IsZero

func (v Value) IsZero() bool

func (Value) Kind

func (v Value) Kind() r.Kind

func (Value) Len

func (v Value) Len() int

func (Value) MapIndex

func (v Value) MapIndex(key Value) Value

func (Value) MapKeys

func (v Value) MapKeys() []Value

func (Value) Method

func (v Value) Method(i int) Value

func (Value) MethodByName

func (v Value) MethodByName(name string) Value

func (Value) NumField

func (v Value) NumField() int

func (Value) NumMethod

func (v Value) NumMethod() int

func (Value) OverflowComplex

func (v Value) OverflowComplex(x complex128) bool

func (Value) OverflowFloat

func (v Value) OverflowFloat(x float64) bool

func (Value) OverflowInt

func (v Value) OverflowInt(x int64) bool

func (Value) OverflowUint

func (v Value) OverflowUint(x uint64) bool

func (Value) Pointer

func (v Value) Pointer() uintptr

func (Value) Recv

func (v Value) Recv() (x Value, ok bool)

func (Value) ReflectValue

func (v Value) ReflectValue() r.Value

func (Value) Send

func (v Value) Send(x Value)

func (Value) Set

func (v Value) Set(x Value)

func (Value) SetBool

func (v Value) SetBool(x bool)

func (Value) SetBytes

func (v Value) SetBytes(x []byte)

func (Value) SetCap

func (v Value) SetCap(n int)

func (Value) SetComplex

func (v Value) SetComplex(x complex128)

func (Value) SetFloat

func (v Value) SetFloat(x float64)

func (Value) SetInt

func (v Value) SetInt(x int64)

func (Value) SetLen

func (v Value) SetLen(n int)

func (Value) SetMapIndex

func (v Value) SetMapIndex(key, elem Value)

func (Value) SetString

func (v Value) SetString(x string)

func (Value) SetUint

func (v Value) SetUint(x uint64)

func (Value) Slice

func (v Value) Slice(i, j int) Value

func (Value) Slice3

func (v Value) Slice3(i, j, k int) Value

func (Value) String

func (v Value) String() string

func (Value) TryRecv

func (v Value) TryRecv() (x Value, ok bool)

func (Value) TrySend

func (v Value) TrySend(x Value) bool

func (Value) Type

func (v Value) Type() r.Type

func (Value) Uint

func (v Value) Uint() uint64

Jump to

Keyboard shortcuts

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