values

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 15 Imported by: 93

Documentation

Index

Constants

View Source
const (
	False = Boolean(false)
	True  = Boolean(true)
)
View Source
const (
	EmptyString = String("")
	SpaceString = String(" ")
)
View Source
const DefaultTimeLayout = time.RFC3339
View Source
const ZeroFloat = Float(0.0)
View Source
const ZeroInt = Int(0)

Variables

View Source
var NaN = Float(math.NaN())
View Source
var None = &none{}
View Source
var ZeroDateTime = DateTime{
	time.Time{},
}

Functions

func GetIn

func GetIn(ctx context.Context, from core.Value, byPath []core.Value) (core.Value, core.PathError)

GetIn checks that from implements core.Getter interface. If it implements, GetIn call from.GetIn method, otherwise iterates over values and tries to resolve a given path.

func Hash added in v0.16.0

func Hash(rtType core.Type, content []byte) uint64

func MapHash added in v0.5.0

func MapHash(input map[string]core.Value) uint64

func MustMarshal added in v0.16.0

func MustMarshal(value core.Value) json.RawMessage

func MustMarshalAny added in v0.16.0

func MustMarshalAny(input interface{}) json.RawMessage

func Parse

func Parse(input interface{}) core.Value

func ReturnOrNext added in v0.16.0

func ReturnOrNext(ctx context.Context, path []core.Value, idx int, out core.Value, err error) (core.Value, core.PathError)

func SetIn

func SetIn(ctx context.Context, to core.Value, byPath []core.Value, value core.Value) core.PathError

func Unmarshal

func Unmarshal(value json.RawMessage) (core.Value, error)

func UnwrapStrings added in v0.15.0

func UnwrapStrings(values []String) []string

Types

type Array

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

func EmptyArray added in v0.14.0

func EmptyArray() *Array

func NewArray

func NewArray(size int) *Array

func NewArrayOf added in v0.16.0

func NewArrayOf(values []core.Value) *Array

func NewArrayWith

func NewArrayWith(values ...core.Value) *Array

func ToArray added in v0.4.0

func ToArray(ctx context.Context, input core.Value) *Array

func (*Array) Clone

func (t *Array) Clone() core.Cloneable

func (*Array) Compare

func (t *Array) Compare(other core.Value) int64

func (*Array) Copy

func (t *Array) Copy() core.Value

func (*Array) Find added in v0.7.0

func (t *Array) Find(predicate ArrayPredicate) (*Array, Boolean)

func (*Array) FindOne added in v0.12.0

func (t *Array) FindOne(predicate ArrayPredicate) (core.Value, Boolean)

func (*Array) First added in v0.16.0

func (t *Array) First() core.Value

func (*Array) ForEach

func (t *Array) ForEach(predicate ArrayPredicate)

func (*Array) Get

func (t *Array) Get(idx Int) core.Value

func (*Array) GetIn added in v0.9.0

func (t *Array) GetIn(ctx context.Context, path []core.Value) (core.Value, core.PathError)

func (*Array) Hash

func (t *Array) Hash() uint64

func (*Array) IndexOf

func (t *Array) IndexOf(item core.Value) Int

func (*Array) Insert

func (t *Array) Insert(idx Int, value core.Value)

func (*Array) Last added in v0.16.0

func (t *Array) Last() core.Value

func (*Array) Length

func (t *Array) Length() Int

func (*Array) MarshalJSON

func (t *Array) MarshalJSON() ([]byte, error)

func (*Array) Push

func (t *Array) Push(item core.Value)

func (*Array) RemoveAt

func (t *Array) RemoveAt(idx Int)

func (*Array) Set

func (t *Array) Set(idx Int, value core.Value) error

func (*Array) Slice

func (t *Array) Slice(from, to Int) *Array

func (*Array) Sort

func (t *Array) Sort() *Array

func (*Array) SortWith added in v0.5.0

func (t *Array) SortWith(sorter ArraySorter) *Array

func (*Array) String

func (t *Array) String() string

func (*Array) Type

func (t *Array) Type() core.Type

func (*Array) Unwrap

func (t *Array) Unwrap() interface{}

type ArrayPredicate

type ArrayPredicate = func(value core.Value, idx int) bool

type ArraySorter added in v0.5.0

type ArraySorter = func(first, second core.Value) bool

type Binary

type Binary []byte

func NewBinary

func NewBinary(values []byte) Binary

func NewBinaryFrom

func NewBinaryFrom(stream io.Reader) (Binary, error)

func (Binary) Compare

func (b Binary) Compare(other core.Value) int64

func (Binary) Copy

func (b Binary) Copy() core.Value

func (Binary) Hash

func (b Binary) Hash() uint64

func (Binary) Length

func (b Binary) Length() Int

func (Binary) MarshalJSON

func (b Binary) MarshalJSON() ([]byte, error)

func (Binary) String

func (b Binary) String() string

func (Binary) Type

func (b Binary) Type() core.Type

func (Binary) Unwrap

func (b Binary) Unwrap() interface{}

type Boolean

type Boolean bool

func IsInf

func IsInf(input Float, sign Int) Boolean

func IsNaN

func IsNaN(input Float) Boolean

func IsNumber added in v0.8.0

func IsNumber(input core.Value) Boolean

func MustParseBoolean added in v0.7.0

func MustParseBoolean(input interface{}) Boolean

func NewBoolean

func NewBoolean(input bool) Boolean

func ParseBoolean

func ParseBoolean(input interface{}) (Boolean, error)

func ToBoolean

func ToBoolean(input core.Value) Boolean

func (Boolean) Compare

func (t Boolean) Compare(other core.Value) int64

func (Boolean) Copy

func (t Boolean) Copy() core.Value

func (Boolean) Hash

func (t Boolean) Hash() uint64

func (Boolean) MarshalJSON

func (t Boolean) MarshalJSON() ([]byte, error)

func (Boolean) String

func (t Boolean) String() string

func (Boolean) Type

func (t Boolean) Type() core.Type

func (Boolean) Unwrap

func (t Boolean) Unwrap() interface{}

type DateTime

type DateTime struct {
	time.Time
}

func MustParseDateTime added in v0.7.0

func MustParseDateTime(input interface{}) DateTime

func NewCurrentDateTime

func NewCurrentDateTime() DateTime

func NewDateTime

func NewDateTime(time time.Time) DateTime

func ParseDateTime

func ParseDateTime(input interface{}) (DateTime, error)

func ParseDateTimeWith

func ParseDateTimeWith(input interface{}, layout string) (DateTime, error)

func (DateTime) Compare

func (t DateTime) Compare(other core.Value) int64

func (DateTime) Copy

func (t DateTime) Copy() core.Value

func (DateTime) Hash

func (t DateTime) Hash() uint64

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (DateTime) String

func (t DateTime) String() string

func (DateTime) Type

func (t DateTime) Type() core.Type

func (DateTime) Unwrap

func (t DateTime) Unwrap() interface{}

type Float

type Float float64

func MustParseFloat added in v0.7.0

func MustParseFloat(input interface{}) Float

func NewFloat

func NewFloat(input float64) Float

func ParseFloat

func ParseFloat(input interface{}) (Float, error)

func ToFloat added in v0.7.0

func ToFloat(input core.Value) Float

func (Float) Compare

func (t Float) Compare(other core.Value) int64

func (Float) Copy

func (t Float) Copy() core.Value

func (Float) Hash

func (t Float) Hash() uint64

func (Float) MarshalJSON

func (t Float) MarshalJSON() ([]byte, error)

func (Float) String

func (t Float) String() string

func (Float) Type

func (t Float) Type() core.Type

func (Float) Unwrap

func (t Float) Unwrap() interface{}

type Int

type Int int64

func MustParseInt added in v0.7.0

func MustParseInt(input interface{}) Int

func NewInt

func NewInt(input int) Int

func ParseInt

func ParseInt(input interface{}) (Int, error)

func ToInt added in v0.7.0

func ToInt(input core.Value) Int

func ToIntDefault added in v0.16.0

func ToIntDefault(input core.Value, defaultValue Int) Int

func (Int) Compare

func (t Int) Compare(other core.Value) int64

func (Int) Copy

func (t Int) Copy() core.Value

func (Int) Hash

func (t Int) Hash() uint64

func (Int) MarshalJSON

func (t Int) MarshalJSON() ([]byte, error)

func (Int) String

func (t Int) String() string

func (Int) Type

func (t Int) Type() core.Type

func (Int) Unwrap

func (t Int) Unwrap() interface{}

type Object

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

func NewObject

func NewObject() *Object

func NewObjectWith

func NewObjectWith(props ...*ObjectProperty) *Object

func ToObject added in v0.16.0

func ToObject(ctx context.Context, input core.Value) *Object

func (*Object) Clone

func (t *Object) Clone() core.Cloneable

func (*Object) Compare

func (t *Object) Compare(other core.Value) int64

Compare compares the source object with other core.Value The behavior of the Compare is similar to the comparison of objects in ArangoDB

func (*Object) Copy

func (t *Object) Copy() core.Value

func (*Object) Find added in v0.12.0

func (t *Object) Find(predicate ObjectPredicate) (core.Value, Boolean)

func (*Object) ForEach

func (t *Object) ForEach(predicate ObjectPredicate)

func (*Object) Get

func (t *Object) Get(key String) (core.Value, Boolean)

func (*Object) GetIn

func (t *Object) GetIn(ctx context.Context, path []core.Value) (core.Value, core.PathError)

func (*Object) Has added in v0.10.0

func (t *Object) Has(key String) Boolean

func (*Object) Hash

func (t *Object) Hash() uint64

func (*Object) Keys

func (t *Object) Keys() []String

func (*Object) Length

func (t *Object) Length() Int

func (*Object) MarshalJSON

func (t *Object) MarshalJSON() ([]byte, error)

func (*Object) MustGet added in v0.7.0

func (t *Object) MustGet(key String) core.Value

func (*Object) MustGetOr added in v0.14.0

func (t *Object) MustGetOr(key String, defaultValue core.Value) core.Value

func (*Object) Remove

func (t *Object) Remove(key String)

func (*Object) Set

func (t *Object) Set(key String, value core.Value)

func (*Object) String

func (t *Object) String() string

func (*Object) Type

func (t *Object) Type() core.Type

func (*Object) Unwrap

func (t *Object) Unwrap() interface{}

func (*Object) Values added in v0.7.0

func (t *Object) Values() []core.Value

type ObjectPredicate

type ObjectPredicate = func(value core.Value, key string) bool

type ObjectProperty

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

func NewObjectProperty

func NewObjectProperty(name string, value core.Value) *ObjectProperty

type String

type String string

func MustParseString added in v0.7.0

func MustParseString(input interface{}) String

func NewString

func NewString(input string) String

func NewStringFromRunes

func NewStringFromRunes(input []rune) String

func ParseString

func ParseString(input interface{}) (String, error)

func ToString added in v0.8.0

func ToString(input core.Value) String

func ToStrings added in v0.15.0

func ToStrings(input *Array) []String

func (String) At added in v0.16.0

func (t String) At(index Int) String

func (String) Compare

func (t String) Compare(other core.Value) int64

func (String) Concat

func (t String) Concat(other core.Value) String

func (String) Contains

func (t String) Contains(other String) Boolean

func (String) Copy

func (t String) Copy() core.Value

func (String) Hash

func (t String) Hash() uint64

func (String) IndexOf

func (t String) IndexOf(other String) Int

func (String) Length

func (t String) Length() Int

func (String) MarshalJSON

func (t String) MarshalJSON() ([]byte, error)

func (String) String

func (t String) String() string

func (String) Type

func (t String) Type() core.Type

func (String) Unwrap

func (t String) Unwrap() interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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