Documentation
¶
Index ¶
- Variables
- func ContainsValue(haystack, needle Value) bool
- func EqualValues(a, b Value) bool
- func IsBoundaryUndefined(x any) bool
- func MatchesValue(haystack, pattern Value) (bool, error)
- func MustNumbers(lhs, rhs Value) (float64, float64, error)
- func ToBoundaryAny(v Value) any
- func TrinaryFrom(b Value) trinary.Value
- func TryToBoundaryAny(v Value) (any, error)
- type Value
- func Bool[T ~bool](x T) Value
- func Callable(ref any) Value
- func Dict(m map[string]Value) Value
- func Document[T any](x T) Value
- func FromAny(x any) Value
- func FromBoundaryAny(x any) Value
- func List(xs []Value) Value
- func Null() Value
- func Number[T ...](x T) Value
- func Object[T any](x T) Value
- func String[T ~string](x T) Value
- func Trinary(x trinary.Value) Value
- func Undefined() Value
- func (v Value) Any() any
- func (v Value) BoolValue() (bool, bool)
- func (v Value) CallableRef() (any, bool)
- func (v Value) DictValue() (map[string]Value, bool)
- func (v Value) DocumentRef() (any, bool)
- func (v Value) IsCallable() bool
- func (v Value) IsNull() bool
- func (v Value) IsUndefined() bool
- func (v Value) IsValid() bool
- func (v Value) Kind() ValueKind
- func (v Value) ListValue() ([]Value, bool)
- func (v Value) MarshalJSON() ([]byte, error)
- func (v Value) NumberValue() (float64, bool)
- func (v Value) ObjectRef() (any, bool)
- func (v Value) SameDocumentRef(other Value) bool
- func (v Value) SameObjectRef(other Value) bool
- func (v Value) String() string
- func (v Value) StringValue() (string, bool)
- func (v Value) TrinaryValue() (trinary.Value, bool)
- type ValueKind
Constants ¶
This section is empty.
Variables ¶
var ErrCallableBoundary = errors.New("callable value cannot cross this boundary")
ErrCallableBoundary is returned when a callable value is forced through a non-native boundary ([]any, JS/module interop, etc.).
Functions ¶
func ContainsValue ¶
ContainsValue implements infix `contains` / `in` semantics for string, list, and dict haystacks. For dict haystacks, only string-key lookup and dict-subset containment are supported.
func EqualValues ¶
EqualValues compares two boxed values for semantic equality (including cross-kind number equality).
func IsBoundaryUndefined ¶
func MatchesValue ¶
MatchesValue returns whether haystack matches the regexp pattern; both must be strings.
func MustNumbers ¶
MustNumbers returns both operands as float64 numbers, or an error if either is not numeric.
func ToBoundaryAny ¶
ToBoundaryAny converts a boxed Value into an unboxed representation suitable for runtime boundaries while preserving undefined/null distinction. Callable values (and nested callables) must not be passed; use TryToBoundaryAny instead.
func TrinaryFrom ¶
TrinaryFrom returns the Kleene trinary outcome for b, matching trinary.From(b.Any()) without materializing an intermediate any slice or map for Box values.
func TryToBoundaryAny ¶
TryToBoundaryAny converts v like ToBoundaryAny but fails if a callable appears anywhere in the value tree.
Types ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
func Callable ¶
Callable wraps a runtime-defined callable value (opaque ref; interpreted in package runtime).
func FromBoundaryAny ¶
FromBoundaryAny converts runtime boundary values back into boxed Value while preserving undefined/null distinction.
func (Value) CallableRef ¶
CallableRef returns the opaque callable payload for ValueCallable.
func (Value) DocumentRef ¶
DocumentRef returns the wrapped host document for ValueDocument. For other kinds it returns (nil, false).
func (Value) IsCallable ¶
IsCallable reports whether v is a first-class callable boxed value.
func (Value) IsUndefined ¶
func (Value) MarshalJSON ¶
func (Value) NumberValue ¶
func (Value) SameDocumentRef ¶
func (Value) SameObjectRef ¶
SameObjectRef is a backward-compatible alias for SameDocumentRef.