runtime

package
v0.0.0-...-382cb39 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DateClass = NewObject()
View Source
var DebugJson = jsoniter.Config{
	EscapeHTML:                    false,
	MarshalFloatWith6Digits:       true,
	ObjectFieldMustBeSimpleString: true,
	SortMapKeys:                   true,
}.Froze()
View Source
var DeltaJson = jsoniter.Config{
	EscapeHTML:                    false,
	MarshalFloatWith6Digits:       true,
	ObjectFieldMustBeSimpleString: true,
}.Froze()
View Source
var Json = jsoniter.Config{
	EscapeHTML:                    false,
	MarshalFloatWith6Digits:       true,
	ObjectFieldMustBeSimpleString: true,
}.Froze()
View Source
var MathClass = NewObject("floor", func(args []interface{}) interface{} {
	switch typedArg := args[0].(type) {
	case float64:
		return int(math.Floor(typedArg))
	case int:
		return typedArg
	default:
		panic("floor does not support type: " + reflect.TypeOf(typedArg).String())
	}
})
View Source
var ObjectClass = NewObject("keys", func(args []interface{}) interface{} {
	obj := args[0].(*DObject)
	keys := make([]interface{}, 0, len(obj.data))
	for key := range obj.data {
		keys = append(keys, key)
	}
	return NewList(keys...)
})

Functions

func Add

func Add(left interface{}, right interface{}) interface{}

func AsBool

func AsBool(val interface{}) bool

func BlackHole

func BlackHole(obj interface{})

supress variable not used error

func Call

func Call(callee interface{}, args ...interface{}) interface{}

func Divide

func Divide(left interface{}, right interface{}) interface{}

func Dump

func Dump(obj interface{}) string

func EQ

func EQ(left interface{}, right interface{}) bool

func GE

func GE(left interface{}, right interface{}) bool

func GT

func GT(left interface{}, right interface{}) bool

func Get

func Get(obj interface{}, path ...interface{}) interface{}

func LE

func LE(left interface{}, right interface{}) bool

func LT

func LT(left interface{}, right interface{}) bool

func Log

func Log(level int, event string, properties ...interface{})

func Multiply

func Multiply(left interface{}, right interface{}) interface{}

func NegativeOf

func NegativeOf(val interface{}) interface{}

func ReportError

func ReportError(funcName string, jsSrc string, jsOffsets []int, goSrc string, goOffsets []int,
	absoluteLineNo int, recovered interface{})

func Subtract

func Subtract(left interface{}, right interface{}) interface{}

func ThriftSchemas

func ThriftSchemas(thriftIDL string) (map[string]*Schema, error)

func Validate

func Validate(obj interface{}, schema *Schema) (err error)

Types

type DList

type DList struct {
	Schema *Schema `json:"-"`
	// contains filtered or unexported fields
}

func NewList

func NewList(data ...interface{}) *DList

func (*DList) Get

func (obj *DList) Get(key interface{}) interface{}

func (*DList) Set

func (obj *DList) Set(keyObj interface{}, value interface{})

type DObject

type DObject struct {
	Schema *Schema `json:"-"`
	// contains filtered or unexported fields
}

func NewObject

func NewObject(kv ...interface{}) *DObject

func (*DObject) Get

func (obj *DObject) Get(key interface{}) interface{}

func (*DObject) Set

func (obj *DObject) Set(keyObj interface{}, value interface{})

type JavascriptError

type JavascriptError struct {
	Recovered interface{}
	// contains filtered or unexported fields
}

func (*JavascriptError) Error

func (err *JavascriptError) Error() string

func (*JavascriptError) MarshalJSON

func (err *JavascriptError) MarshalJSON() ([]byte, error)

func (*JavascriptError) String

func (err *JavascriptError) String() string

type Object

type Object interface {
	Set(key interface{}, value interface{})
	Get(key interface{}) interface{}
}

func AsObj

func AsObj(val interface{}) Object

type Schema

type Schema struct {
	Fields    map[string]*Schema
	Element   *Schema
	Validator func(value interface{}) error
}

type Thrown

type Thrown struct {
	Value interface{}
}

func (Thrown) Error

func (thrown Thrown) Error() string

func (Thrown) ErrorNumber

func (thrown Thrown) ErrorNumber() int

func (Thrown) MarshalJSON

func (thrown Thrown) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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