object

package
v0.0.0-...-1139f41 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NULL  = "NULL"
	ARRAY = "ARRAY"

	INTEGER = "INTEGER"
	FLOAT   = "FLOAT"
	BOOLEAN = "BOOLEAN"
	STRING  = "STRING"

	BUILTIN = "BUILTIN"
)

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(o Object) bool

IsEmpty returns if an object is empty

func IsEqual

func IsEqual(l Object, r Object) bool

IsEqual returns if two objects are equal

func IsNull

func IsNull(o Object) bool

IsNull returns an object is Null or not

func ToNativeBool

func ToNativeBool(o Object) bool

ToNativeBool convert object to native bool value

func ToNativeFloat64

func ToNativeFloat64(o Object) float64

ToNativeFloat64 convert object to native float64 value

func ToNativeInt64

func ToNativeInt64(o Object) int64

ToNativeInt64 convert object to native int64 value

func ToNativeString

func ToNativeString(o Object) string

ToNativeString convert object to native string value

Types

type Array

type Array struct {
	Elements []Object
}

Array Array builtin type

func (*Array) Cast

func (a *Array) Cast(t Type) Object

Cast type cast

func (*Array) Equals

func (a *Array) Equals(o Object) bool

Equals returns if two objects are equal

func (*Array) Inspect

func (a *Array) Inspect() string

Inspect return value as string

func (*Array) Type

func (a *Array) Type() Type

Type type string

type Boolean

type Boolean struct {
	Value bool
}

Boolean Boolean builtin type

func (*Boolean) Cast

func (b *Boolean) Cast(t Type) Object

Cast type cast

func (*Boolean) Equals

func (b *Boolean) Equals(o Object) bool

Equals returns if two objects are equal

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

HashKey implements the HashMap interface for comparing whether values are the same or not.

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

Inspect return value as string

func (*Boolean) Type

func (b *Boolean) Type() Type

Type type string

type Float

type Float struct {
	Value float64
}

Float float builtin type

func (*Float) Cast

func (f *Float) Cast(t Type) Object

Cast type cast

func (*Float) Equals

func (f *Float) Equals(o Object) bool

Equals returns if two objects are equal

func (*Float) HashKey

func (f *Float) HashKey() HashKey

HashKey implements the HashMap interface for comparing whether values are the same or not.

func (*Float) Inspect

func (f *Float) Inspect() string

Inspect return value as string

func (*Float) Type

func (f *Float) Type() Type

Type type string

type HashKey

type HashKey struct {
	Type  Type
	Value uint64
}

HashKey object hash key

type Hashable

type Hashable interface {
	HashKey() HashKey
}

Hashable base type

type Integer

type Integer struct {
	Value int64
}

Integer Integer builtin type

func (*Integer) Cast

func (i *Integer) Cast(t Type) Object

Cast type cast

func (*Integer) Equals

func (i *Integer) Equals(o Object) bool

Equals returns if two objects are equal

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

HashKey implements the HashMap interface for comparing whether values are the same or not.

func (*Integer) Inspect

func (i *Integer) Inspect() string

Inspect return value as string

func (*Integer) Type

func (i *Integer) Type() Type

Type type string

type Null

type Null struct {
}

Null null builtin type

func (*Null) Cast

func (n *Null) Cast(t Type) Object

Cast type cast

func (*Null) Equals

func (n *Null) Equals(o Object) bool

Equals returns if two objects are equal

func (*Null) Inspect

func (n *Null) Inspect() string

Inspect return value as string

func (*Null) Type

func (n *Null) Type() Type

Type type string

type Object

type Object interface {
	Type() Type
	Inspect() string
	Cast(Type) Object
	Equals(Object) bool
}

Object base type

func NativeToObject

func NativeToObject(v interface{}) Object

NativeToObject convert native interface to Object

func ToNativeArray

func ToNativeArray(o Object) []Object

ToNativeArray convert object to native Object slice

type String

type String struct {
	Value string
}

String String builtin type

func (*String) Cast

func (s *String) Cast(t Type) Object

Cast type cast

func (*String) Equals

func (s *String) Equals(o Object) bool

Equals returns if two objects are equal

func (*String) HashKey

func (s *String) HashKey() HashKey

HashKey implements the HashMap interface for comparing whether values are the same or not.

func (*String) Inspect

func (s *String) Inspect() string

Inspect return value as string

func (*String) Type

func (s *String) Type() Type

Type type string

type Type

type Type string

Type object type name

Jump to

Keyboard shortcuts

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