values

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 10 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Proto

func Proto(v Value) *pb.Value

func ProtoMap

func ProtoMap(v *Map) *pb.Map

func Unwrap

func Unwrap(v Value) (any, error)

Types

type BigInt

type BigInt struct {
	Underlying *big.Int
}

func NewBigInt

func NewBigInt(b *big.Int) *BigInt

func (*BigInt) Unwrap

func (b *BigInt) Unwrap() (any, error)

func (*BigInt) UnwrapTo

func (b *BigInt) UnwrapTo(to any) error

type Bool

type Bool struct {
	Underlying bool
}

func NewBool

func NewBool(b bool) *Bool

func (*Bool) Unwrap

func (b *Bool) Unwrap() (any, error)

func (*Bool) UnwrapTo

func (b *Bool) UnwrapTo(to any) error

type Bytes

type Bytes struct {
	Underlying []byte
}

func NewBytes

func NewBytes(b []byte) *Bytes

func (*Bytes) Unwrap

func (b *Bytes) Unwrap() (any, error)

func (*Bytes) UnwrapTo

func (b *Bytes) UnwrapTo(to any) error

type Decimal

type Decimal struct {
	Underlying decimal.Decimal
}

func NewDecimal

func NewDecimal(d decimal.Decimal) *Decimal

func (*Decimal) Unwrap

func (d *Decimal) Unwrap() (any, error)

func (*Decimal) UnwrapTo

func (d *Decimal) UnwrapTo(to any) error

type Float64

type Float64 struct {
	Underlying float64
}

func NewFloat64

func NewFloat64(f float64) *Float64

func (*Float64) Unwrap

func (f *Float64) Unwrap() (any, error)

func (*Float64) UnwrapTo

func (f *Float64) UnwrapTo(to any) error

type Int64

type Int64 struct {
	Underlying int64
}

func NewInt64

func NewInt64(i int64) *Int64

func (*Int64) Unwrap

func (i *Int64) Unwrap() (any, error)

func (*Int64) UnwrapTo

func (i *Int64) UnwrapTo(to any) error

type List

type List struct {
	Underlying []Value
}

func FromListValueProto

func FromListValueProto(lv *pb.List) (*List, error)

func NewList

func NewList(l []any) (*List, error)

func (*List) CopyList

func (l *List) CopyList() *List

func (*List) Unwrap

func (l *List) Unwrap() (any, error)

func (*List) UnwrapTo

func (l *List) UnwrapTo(to any) error

type Map

type Map struct {
	Underlying map[string]Value
}

func CreateMapFromStruct

func CreateMapFromStruct(v any) (*Map, error)

func EmptyMap

func EmptyMap() *Map

func FromMapValueProto

func FromMapValueProto(mv *pb.Map) (*Map, error)

func NewMap

func NewMap(m map[string]any) (*Map, error)

func WrapMap

func WrapMap(a any) (*Map, error)

func (*Map) CopyMap

func (m *Map) CopyMap() *Map

func (*Map) DeleteAtPath

func (m *Map) DeleteAtPath(path string) bool

DeleteAtPath deletes a value from a map at a given dot separated path. Returns true if an element at the given path was found and deleted, false otherwise.

func (*Map) Unwrap

func (m *Map) Unwrap() (any, error)

func (*Map) UnwrapTo

func (m *Map) UnwrapTo(to any) error

type String

type String struct {
	Underlying string
}

func NewString

func NewString(s string) *String

func (*String) Unwrap

func (s *String) Unwrap() (any, error)

func (*String) UnwrapTo

func (s *String) UnwrapTo(to any) error

type Time

type Time struct {
	Underlying time.Time
}

func NewTime

func NewTime(t time.Time) *Time

func (*Time) Unwrap

func (t *Time) Unwrap() (any, error)

func (*Time) UnwrapTo

func (t *Time) UnwrapTo(to any) error

type Unwrappable

type Unwrappable interface {
	Unwrap() (any, error)
	UnwrapTo(any) error
}

type Value

type Value interface {
	Unwrappable
	// contains filtered or unexported methods
}

func Copy

func Copy(v Value) Value

func FromProto

func FromProto(val *pb.Value) (Value, error)

func Wrap

func Wrap(v any) (Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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