Documentation
¶
Index ¶
- func CtxValue[T any](ctx context.Context) *T
- func CtxWith[T any](parent context.Context, v *T) context.Context
- func DefaultLogHandler(log *Log)
- func DoIfCtxValueValid[T any, TI isValid[T]](ctx context.Context, fn func(v *T))
- type Kind
- type List
- type Log
- type Map
- type Value
- func (v *Value) Append(vs ...Value)
- func (v Value) GoString() string
- func (v *Value) Is(k Kind) bool
- func (v *Value) Kind() Kind
- func (v Value) MarshalCBOR() ([]byte, error)
- func (v Value) MarshalJSON() ([]byte, error)
- func (v *Value) Merge(m Map)
- func (v Value) Ptr() *Value
- func (v *Value) Set(key string, value Value)
- func (v Value) ToAny() any
- func (v Value) ToBigInt() *big.Int
- func (v Value) ToBool() bool
- func (v Value) ToFloat64() float64
- func (v Value) ToInt64() int64
- func (v *Value) ToList() List
- func (v *Value) ToMap() Map
- func (v Value) ToString() string
- func (v Value) ToTime() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLogHandler ¶
func DefaultLogHandler(log *Log)
func DoIfCtxValueValid ¶
DoIfCtxValueValid calls the function fn with the Value stored in the context.Context. If the Value is not valid, the function fn will not be called.
Types ¶
type Map ¶
Map represents a map of string to Value.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value represents a value of a set of types.
func (*Value) Append ¶
Append appends more Values to the List Value. If the Value is not a List, it will panic.
func (Value) MarshalCBOR ¶
MarshalCBOR returns the CBOR encoding of the Value.
func (Value) MarshalJSON ¶
MarshalJSON returns the JSON encoding of the Value.
func (*Value) Merge ¶
Merge merges the given Set into the current Value. If the Value is not a Set, it will panic.
func (*Value) Set ¶
Merge merges the given Set into the current Value. If the Value is not a Set, it will panic.
func (Value) ToBigInt ¶
ToBigInt returns the *big.Int value. If Kind is not BigInt, it returns &big.Int{}.