eval

package
v0.0.0-...-0e7933b Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLASS_OBJ        = "CLASS_OBJ"
	INSTANCE_OBJ     = "INSTANCE_OBJ"
	METHODINFO_OBJ   = "METHODINFO_OBJ"
	PROPERTYINFO_OBJ = "PROPERTYINFO_OBJ"
)
View Source
const (
	ADD_BP = iota
	DEL_BP
)
View Source
const (
	PREFIXOP int
	INFIXOP
	POSTFIXOP
	MOD_ASSIGNOP
	UNKNOWNIDENT
	UNKNOWNIDENTEX
	NOMETHODERROR
	NOMETHODERROREX
	NOINDEXERROR
	KEYERROR
	INDEXERROR
	SLICEERROR
	ARGUMENTERROR
	INPUTERROR
	RTERROR
	PARAMTYPEERROR
	INLENERR
	INVALIDARG
	DIVIDEBYZERO
	THROWERROR
	THROWNOTHANDLED
	GREPMAPNOTITERABLE
	NOTITERABLE
	RANGETYPEERROR
	DEFERERROR
	SPAWNERROR
	ASSERTIONERROR
	//	STDLIBERROR
	NULLABLEERROR
	JSONERROR
	DBSCANERROR
	FUNCCALLBACKERROR
	FILEMODEERROR
	FILEOPENERROR
	NOTCLASSERROR
	PARENTNOTDECL
	CLSNOTDEFINE
	CLSMEMBERPRIVATE
	CLSCALLPRIVATE
	PROPERTYUSEERROR
	MEMBERUSEERROR
	INDEXERUSEERROR
	INDEXERTYPEERROR
	INDEXERSTATICERROR
	INDEXNOTFOUNDERROR
	CALLNONSTATICERROR
	CLASSCATEGORYERROR
	CLASSCREATEERROR
	PARENTNOTANNOTATION
	OVERRIDEERROR
	METAOPERATORERROR
	SERVICENOURLERROR
	CONSTNOTASSIGNERROR
	DIAMONDOPERERROR
	NAMENOTEXPORTED
	IMPORTERROR
	GENERICERROR
)

constants for error types

View Source
const (
	SKIP_DIR     = 1
	FILEPATH_OBJ = "FILEPATH_OBJ"
)
View Source
const (
	HTTP_OBJ       = "HTTP_OBJ"
	HTTPCLIENT_OBJ = "HTTPCLIENT_OBJ"
	HTTPSERVER_OBJ = "HTTPSERVER_OBJ"

	HTTPRESPONSE_OBJ = "HTTPRESPONSE_OBJ"
	HTTPREQUEST_OBJ  = "HTTPREQUEST_OBJ"

	HTTPRESPONSEWRITER_OBJ = "HTTPRESPONSEWRITER_OBJ"
	HTTPHEADER_OBJ         = "HTTPHEADER_OBJ"
)
View Source
const (
	LIST_OBJ     = "LIST_OBJ"
	LISTELEM_OBJ = "LISTELEM_OBJ"
)
View Source
const (
	TCPCONN_OBJ     = "TCP_CONN_OBJ"
	TCPLISTENER_OBJ = "TCP_LISTENER_OBJ"

	UDPCONN_OBJ = "UDP_CONN_OBJ"

	UNIXCONN_OBJ     = "UNIX_CONN_OBJ"
	UNIXLISTENER_OBJ = "UNIX_LISTENER_OBJ"
)
View Source
const (
	UTC   = 0
	LOCAL = 1

	INTEGER_OBJ      = "INTEGER"
	UINTEGER_OBJ     = "UINTEGER"
	FLOAT_OBJ        = "FLOAT"
	BOOLEAN_OBJ      = "BOOLEAN"
	RETURN_VALUE_OBJ = "RETURN_VALUE"
	BREAK_OBJ        = "BREAK"
	CONTINUE_OBJ     = "CONTINUE"
	ERROR_OBJ        = "ERROR"
	FUNCTION_OBJ     = "FUNCTION"
	STRING_OBJ       = "STRING"
	BUILTIN_OBJ      = "BUILTIN"
	ARRAY_OBJ        = "ARRAY"
	TUPLE_OBJ        = "TUPLE"
	HASH_OBJ         = "HASH"
	IMPORTED_OBJ     = "IMPORT"
	STRUCT_OBJ       = "STRUCT"
	ENUM_OBJ         = "ENUM"
	FILE_OBJ         = "FILE"
	REGEX_OBJ        = "REGEX"
	CHANNEL_OBJ      = "CHANNEL"
	NIL_OBJ          = "NIL_OBJ"
	GO_OBJ           = "GO_OBJ"
	GFO_OBJ          = "GFO_OBJ"
	THROW_OBJ        = "THROW"
)
View Source
const (
	DBSQL_OBJ    = "DBSQL_OBJ"    //sql object
	DBRESULT_OBJ = "DBRESULT_OBJ" //result object

	DBROW_OBJ  = "DBROW_OBJ"  //row object
	DBROWS_OBJ = "DBROWS_OBJ" //rows object

	DBSTMT_OBJ = "DBSTMT_OBJ" //statement object
	DBTX_OBJ   = "DBTX_OBJ"   //transaction object
)
View Source
const (
	SYNCCOND_OBJ      = "SYNCCOND_OBJ"
	SYNCONCE_OBJ      = "SYNCONCE_OBJ"
	SYNCMUTEX_OBJ     = "SYNCMUTEX_OBJ"
	SYNCRWMUTEX_OBJ   = "SYNCRWMUTEX_OBJ"
	SYNCWAITGROUP_OBJ = "SYNCWAITGROUP_OBJ"
)
View Source
const (
	TEMPLATE_OBJ = "TEMPLATE_OBJ"

	T_TEXT = 0
	T_HTML = 1
)
View Source
const BUILTINMETHOD_OBJ = "BUILTINMETHOD_OBJ"
View Source
const (
	CSV_OBJ = "CSV_OBJ"
)
View Source
const DECIMAL_OBJ = "DECIMAL_OBJ"
View Source
const FILEINFO_OBJ = "FILEINFO_OBJ"
View Source
const (
	FLAG_OBJ = "FLAG_OBJ"
)
View Source
const (
	FMT_OBJ = "FMT_OBJ"
)
View Source
const GROUP_OBJ = "GROUP_OBJ"
View Source
const (
	IOUTIL_OBJ = "IOUTIL_OBJ"
)
View Source
const (
	JSON_OBJ = "JSON_OBJ"
)
View Source
const KEYVALUE_OBJ = "KEYVALUE_OBJ"
View Source
const LINQ_OBJ = "LINQ_OBJ"
View Source
const (
	LOGGER_OBJ = "LOGGER_OBJ"
)
View Source
const (
	LineStep = 5
)
View Source
const (
	MATH_OBJ = "MATH_OBJ"
)
View Source
const MISS_THRESHOLD = 2
View Source
const (
	NET_OBJ = "NET_OBJ"
)

Net Object

View Source
const (
	OPTIONAL_OBJ = "OPTIONAL_OBJ"
)
View Source
const (
	OS_OBJ = "OS_OBJ"
)
View Source
const PIPE_OBJ = "PIPE_OBJ"
View Source
const (
	REGEXP_OBJ = "REGEXP_OBJ"
)

REGEXP OBJECT

View Source
const (
	SERVICE_OBJ = "SERVICE_OBJ"
)
View Source
const (
	SORT_OBJ = "SORT_OBJ"
)
View Source
const (
	SQL_OBJ = "SQL_OBJ"
)
View Source
const (
	STRINGS_OBJ = "STRINGS_OBJ"
)
View Source
const ServiceHint = "* Running on %s (Press CTRL+C to quit)\n"
View Source
const (
	TIME_OBJ = "TIME_OBJ"
)
View Source
const (
	UNICODE_OBJ = "UNICODE_OBJ"
)

Variables

View Source
var (
	TRUE     = &Boolean{Bool: true, Valid: true}
	FALSE    = &Boolean{Bool: false, Valid: true}
	BREAK    = &Break{}
	CONTINUE = &Continue{}
	NIL      = &Nil{}
	EMPTY    = &Optional{Value: NIL}
)
View Source
var (
	// ErrMethodMismatch is returned when the method in the request does not match
	// the method defined against the route.
	ErrMethodMismatch = errors.New("method is not allowed")
	// ErrNotFound is returned when no route match is found.
	ErrNotFound = errors.New("no matching route was found")
)

============================================================================

	BELOW IS THE SOURCE OF MUX(https://github.com/gorilla/mux)
 ============================================================================
View Source
var BASE_CLASS = &Class{
	Name:    "object",
	Parent:  nil,
	Members: nil,
	Methods: map[string]ClassMethod{},
}

The base class of all classes in magpie

View Source
var BuiltinClasses = map[string]*Class{
	"object":   BASE_CLASS,
	"Override": OVERRIDE_ANNOCLASS,
	"NotNull":  NOTNULL_ANNOCLASS,
	"NotEmpty": NOTEMPTY_ANNOCLASS,
}
View Source
var DivisionPrecision = 16

DivisionPrecision is the number of decimal places in the result when it doesn't divide exactly.

Example:

d1 := decimal.NewFromFloat(2).Div(decimal.NewFromFloat(3)
d1.String() // output: "0.6666666666666667"
d2 := decimal.NewFromFloat(2).Div(decimal.NewFromFloat(30000)
d2.String() // output: "0.0000666666666667"
d3 := decimal.NewFromFloat(20000).Div(decimal.NewFromFloat(3)
d3.String() // output: "6666.6666666666666667"
decimal.DivisionPrecision = 3
d4 := decimal.NewFromFloat(2).Div(decimal.NewFromFloat(3)
d4.String() // output: "0.667"
View Source
var GlobalMutex sync.RWMutex
View Source
var GlobalScopes map[string]Object = make(map[string]Object)
View Source
var MarshalJSONWithoutQuotes = false

MarshalJSONWithoutQuotes should be set to true if you want the decimal to be JSON marshaled as a number, instead of as a string. WARNING: this is dangerous for decimals with many digits, since many JSON unmarshallers (ex: Javascript's) will unmarshal JSON numbers to IEEE 754 double-precision floating point numbers, which means you can potentially silently lose precision.

View Source
var NOTEMPTY_ANNOCLASS = &Class{
	Name:         "NotEmpty",
	Parent:       BASE_CLASS,
	IsAnnotation: true,
}

Builtin @NotEmpty annotation class Asserts that the annotated string, tuple, map or array is not null or empty.

View Source
var NOTNULL_ANNOCLASS = &Class{
	Name:         "NotNull",
	Parent:       BASE_CLASS,
	IsAnnotation: true,
}

Builtin @NotNull annotation class The annotated element must not be {@code null}.

View Source
var OVERRIDE_ANNOCLASS = &Class{
	Name:         "Override",
	Parent:       BASE_CLASS,
	IsAnnotation: true,
}

Builtin @Override annotation class

View Source
var REPLColor bool

REPL with color support

View Source
var SkipRouter = errors.New("skip this router")

SkipRouter is used as a return value from WalkFuncs to indicate that the router that walk is about to descend down to should be skipped.

View Source
var Zero = NewDec(0, 1)

Zero constant, to make computations faster.

Functions

func Distance

func Distance(str1, str2 string) int

The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character http://en.wikipedia.org/wiki/Levenshtein_distance

This implemention is optimized to use O(min(m,n)) space. It is based on the optimized C version found here: http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#C

func Float64sAreSorted

func Float64sAreSorted(a []float64, o Ordering) bool

Float64sAreSorted tests whether a slice of float64s is sorted in ascending/descending order.

func InstanceOf

func InstanceOf(className string, oi *ObjectInstance) bool

func IntsAreSorted

func IntsAreSorted(a []int64, o Ordering) bool

IntsAreSorted tests whether a slice of ints is sorted in ascending/descending order.

func IsTrue

func IsTrue(obj Object) bool

Helper function IsTrue for IF evaluation - neccessity is dubious

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

Below code will cause panic(mainly request body handling)

func ObjectToValue

func ObjectToValue(obj Object, typ reflect.Type) reflect.Value

Magpie language Object to go language Value.

func PanicToError

func PanicToError(p interface{}, node ast.Node) error

func RegisterBuiltin

func RegisterBuiltin(name string, f *Builtin)

func RegisterFunctions

func RegisterFunctions(name string, vars map[string]interface{})

func RegisterVars

func RegisterVars(name string, vars map[string]interface{})

func ServeHTTP

func ServeHTTP(scope *Scope, f *Function, w http.ResponseWriter, r *http.Request)

func ServeService

func ServeService(line string, scope *Scope, f *Function, w http.ResponseWriter, r *http.Request)

func SetGlobalObj

func SetGlobalObj(name string, Obj Object)

func StringsAreSorted

func StringsAreSorted(a []string, o Ordering) bool

StringsAreSorted tests whether a slice of strings is sorted in ascending/descending order.

func TypoSuggestions

func TypoSuggestions(keys []string, miss string) []string

func UIntsAreSorted

func UIntsAreSorted(a []uint64, o Ordering) bool

UIntsAreSorted tests whether a slice of uints is sorted in ascending/descending order.

func Vars

func Vars(r *http.Request) map[string]string

Vars returns the route variables for the current request, if any.

Types

type Array

type Array struct {
	Members []Object
}

func (*Array) Average

func (a *Array) Average(line string, args ...Object) Object

func (*Array) CallMethod

func (a *Array) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Array) Count

func (a *Array) Count(line string, args ...Object) Object

func (*Array) Empty

func (a *Array) Empty(line string, args ...Object) Object

func (*Array) Filter

func (a *Array) Filter(line string, scope *Scope, args ...Object) Object

func (*Array) First

func (a *Array) First(line string, args ...Object) Object

func (*Array) Get

func (a *Array) Get(line string, args ...Object) Object

func (*Array) Includes

func (a *Array) Includes(line string, args ...Object) Object

func (*Array) Index

func (a *Array) Index(line string, args ...Object) Object

func (*Array) Inspect

func (a *Array) Inspect() string

func (*Array) Last

func (a *Array) Last(line string, args ...Object) Object

func (*Array) Len

func (a *Array) Len(line string, args ...Object) Object

func (*Array) Map

func (a *Array) Map(line string, scope *Scope, args ...Object) Object

func (*Array) MarshalJSON

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

Json marshal handling

func (*Array) Max

func (a *Array) Max(line string, args ...Object) Object

Max returns the maximum value in a collection of values.

func (*Array) Merge

func (a *Array) Merge(line string, args ...Object) Object

func (*Array) Min

func (a *Array) Min(line string, args ...Object) Object

Min returns the minimum value in a collection of values.

func (*Array) Pop

func (a *Array) Pop(line string, args ...Object) Object

func (*Array) Push

func (a *Array) Push(line string, args ...Object) Object

func (*Array) Reduce

func (a *Array) Reduce(line string, scope *Scope, args ...Object) Object

func (*Array) Set

func (a *Array) Set(line string, args ...Object) Object

func (*Array) Shift

func (a *Array) Shift(line string, args ...Object) Object

func (*Array) Sum

func (a *Array) Sum(line string, args ...Object) Object

func (*Array) Tail

func (a *Array) Tail(line string, args ...Object) Object

func (*Array) Type

func (a *Array) Type() ObjectType

func (*Array) UnShift

func (a *Array) UnShift(line string, args ...Object) Object

func (*Array) UnmarshalJSON

func (a *Array) UnmarshalJSON(b []byte) error

type Boolean

type Boolean struct {
	Bool  bool
	Valid bool
	//sometimes when a function fails, it will return `false`. If this happens, we also need to
	//know the error reason. The error message is stored in `OptionalMsg`
	OptionalMsg string
}

func NewBooleanObj

func NewBooleanObj(b bool) *Boolean

Returns a new valid boolean object

func NewFalseObj

func NewFalseObj(s string) *Boolean

func (*Boolean) CallMethod

func (b *Boolean) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) IsValid

func (b *Boolean) IsValid(line string, args ...Object) Object

func (*Boolean) MarshalJSON

func (b *Boolean) MarshalJSON() ([]byte, error)

func (*Boolean) Message

func (b *Boolean) Message(line string, args ...Object) Object

func (*Boolean) Scan

func (b *Boolean) Scan(value interface{}) error

func (*Boolean) SetValid

func (b *Boolean) SetValid(line string, args ...Object) Object

func (*Boolean) ToTrueFalse

func (b *Boolean) ToTrueFalse(line string, args ...Object) Object

func (*Boolean) ToYesNo

func (b *Boolean) ToYesNo(line string, args ...Object) Object

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

func (*Boolean) UnmarshalJSON

func (b *Boolean) UnmarshalJSON(bytes []byte) error

func (Boolean) Value

func (b Boolean) Value() (driver.Value, error)

type Break

type Break struct{}

func (*Break) CallMethod

func (b *Break) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Break) Inspect

func (b *Break) Inspect() string

func (*Break) Type

func (b *Break) Type() ObjectType

type BuildVarsFunc

type BuildVarsFunc func(map[string]string) map[string]string

BuildVarsFunc is the function signature used by custom build variable functions (which can modify route variables before a route's URL is built).

type Builtin

type Builtin struct {
	Fn BuiltinFunc
}

func (*Builtin) CallMethod

func (b *Builtin) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type BuiltinFunc

type BuiltinFunc func(line string, scope *Scope, args ...Object) Object

type BuiltinMethod

type BuiltinMethod struct {
	Fn       BuiltinMethodFunction
	Instance *ObjectInstance
}

func MakeBuiltinMethod

func MakeBuiltinMethod(fn BuiltinMethodFunction) *BuiltinMethod

func (*BuiltinMethod) CallMethod

func (b *BuiltinMethod) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*BuiltinMethod) Inspect

func (b *BuiltinMethod) Inspect() string

func (*BuiltinMethod) Type

func (b *BuiltinMethod) Type() ObjectType

type BuiltinMethodFunction

type BuiltinMethodFunction func(line string, self *ObjectInstance, scope *Scope, args ...Object) Object

type CallFrame

type CallFrame struct {
	FuncScope   *Scope
	CurrentCall *ast.CallExpression // currently calling function
	// contains filtered or unexported fields
}

type CallStack

type CallStack struct {
	Frames []CallFrame
}

CallStack is a stack for CallFrame

type ChanObject

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

func (*ChanObject) CallMethod

func (c *ChanObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ChanObject) Close

func (c *ChanObject) Close(line string, args ...Object) Object

func (*ChanObject) Inspect

func (c *ChanObject) Inspect() string

func (*ChanObject) Recv

func (c *ChanObject) Recv(line string, args ...Object) Object

func (*ChanObject) Send

func (c *ChanObject) Send(line string, args ...Object) Object

func (*ChanObject) Type

func (c *ChanObject) Type() ObjectType

type Class

type Class struct {
	Name         string
	Parent       *Class
	Members      []*ast.LetStatement
	Methods      map[string]ClassMethod //BuiltinMethod or Function object
	Properties   map[string]*ast.PropertyDeclStmt
	Scope        *Scope
	IsAnnotation bool //true if the class is an annotation class
}

func (*Class) CallMethod

func (c *Class) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Class) CheckMembers

func (c *Class) CheckMembers(val string) bool

func (*Class) CheckMethods

func (c *Class) CheckMethods(val string) bool

func (*Class) CheckProperties

func (c *Class) CheckProperties(val string) bool

func (*Class) GetMethod

func (c *Class) GetMethod(name string) ClassMethod

func (*Class) GetModifierLevel

func (c *Class) GetModifierLevel(name string, kind ClassComponentKind) ast.ModifierLevel

func (*Class) GetProperty

func (c *Class) GetProperty(name string) *ast.PropertyDeclStmt

func (*Class) Inspect

func (c *Class) Inspect() string

func (*Class) IsAnnotationPresent

func (c *Class) IsAnnotationPresent(line string, args ...Object) Object

func (*Class) IsStatic

func (c *Class) IsStatic(val string, kind ClassComponentKind) bool

Check whether member, method or property is static or not.

func (*Class) Type

func (c *Class) Type() ObjectType

type ClassComponentKind

type ClassComponentKind byte
const (
	ClassMemberKind ClassComponentKind = iota
	ClassMethodKind
	ClassPropertyKind
)

type ClassMethod

type ClassMethod interface {
	Object
	// contains filtered or unexported methods
}

type Closeable

type Closeable interface {
	// contains filtered or unexported methods
}

Whether the Object is closable(mainly used for 'using' statement)

type Context

type Context struct {
	N []ast.Node //N: node
	S *Scope     //S: Scope
}

type Continue

type Continue struct{}

func (*Continue) CallMethod

func (c *Continue) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Continue) Inspect

func (c *Continue) Inspect() string

func (*Continue) Type

func (c *Continue) Type() ObjectType

type CsvObj

type CsvObj struct {
	Reader     *csv.Reader
	ReaderFile *os.File

	Writer *csv.Writer
}

func (*CsvObj) CallMethod

func (c *CsvObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*CsvObj) CloseReader

func (c *CsvObj) CloseReader(line string, args ...Object) Object

func (*CsvObj) Flush

func (c *CsvObj) Flush(line string, args ...Object) Object

func (*CsvObj) Inspect

func (c *CsvObj) Inspect() string

func (*CsvObj) Read

func (c *CsvObj) Read(line string, args ...Object) Object

func (*CsvObj) ReadAll

func (c *CsvObj) ReadAll(line string, args ...Object) Object

func (*CsvObj) SetOptions

func (c *CsvObj) SetOptions(line string, args ...Object) Object

func (*CsvObj) Type

func (c *CsvObj) Type() ObjectType

func (*CsvObj) Write

func (c *CsvObj) Write(line string, args ...Object) Object

func (*CsvObj) WriteAll

func (c *CsvObj) WriteAll(line string, args ...Object) Object

type DbResultObject

type DbResultObject struct {
	Result sql.Result
	Name   string
}

***************************************************************

DB Result Object

***************************************************************

func (*DbResultObject) CallMethod

func (r *DbResultObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*DbResultObject) Inspect

func (r *DbResultObject) Inspect() string

func (*DbResultObject) LastInsertId

func (r *DbResultObject) LastInsertId(line string, args ...Object) Object

func (*DbResultObject) RowsAffected

func (r *DbResultObject) RowsAffected(line string, args ...Object) Object

func (*DbResultObject) Type

func (r *DbResultObject) Type() ObjectType

type DbRowObject

type DbRowObject struct {
	Row  *sql.Row
	Name string
}

***************************************************************

DB Row Object

***************************************************************

func (*DbRowObject) CallMethod

func (r *DbRowObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*DbRowObject) Inspect

func (r *DbRowObject) Inspect() string

func (*DbRowObject) Scan

func (r *DbRowObject) Scan(line string, args ...Object) Object

func (*DbRowObject) Type

func (r *DbRowObject) Type() ObjectType

type DbRowsObject

type DbRowsObject struct {
	Rows *sql.Rows
	Name string
}

***************************************************************

DB Rows Object

***************************************************************

func (*DbRowsObject) CallMethod

func (r *DbRowsObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*DbRowsObject) Close

func (r *DbRowsObject) Close(line string, args ...Object) Object

func (*DbRowsObject) Columns

func (r *DbRowsObject) Columns(line string, args ...Object) Object

func (*DbRowsObject) Err

func (r *DbRowsObject) Err(line string, args ...Object) Object

func (*DbRowsObject) Inspect

func (r *DbRowsObject) Inspect() string

func (*DbRowsObject) Next

func (r *DbRowsObject) Next(line string, args ...Object) Object

func (*DbRowsObject) Scan

func (r *DbRowsObject) Scan(line string, args ...Object) Object

func (*DbRowsObject) Type

func (r *DbRowsObject) Type() ObjectType

type DbStmtObject

type DbStmtObject struct {
	Stmt *sql.Stmt
	Name string
}

***************************************************************

DB Statement Object

***************************************************************

func (*DbStmtObject) CallMethod

func (s *DbStmtObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*DbStmtObject) Close

func (s *DbStmtObject) Close(line string, args ...Object) Object

func (*DbStmtObject) Exec

func (s *DbStmtObject) Exec(line string, args ...Object) Object

func (*DbStmtObject) Inspect

func (s *DbStmtObject) Inspect() string

func (*DbStmtObject) Query

func (s *DbStmtObject) Query(line string, args ...Object) Object

func (*DbStmtObject) QueryRow

func (s *DbStmtObject) QueryRow(line string, args ...Object) Object

func (*DbStmtObject) Type

func (s *DbStmtObject) Type() ObjectType

type DbTxObject

type DbTxObject struct {
	Tx   *sql.Tx
	Name string
}

***************************************************************

DB Transaction object

***************************************************************

func (*DbTxObject) CallMethod

func (t *DbTxObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*DbTxObject) Commit

func (t *DbTxObject) Commit(line string, args ...Object) Object

func (*DbTxObject) Exec

func (t *DbTxObject) Exec(line string, args ...Object) Object

func (*DbTxObject) Inspect

func (t *DbTxObject) Inspect() string

func (*DbTxObject) Prepare

func (t *DbTxObject) Prepare(line string, args ...Object) Object

func (*DbTxObject) Query

func (t *DbTxObject) Query(line string, args ...Object) Object

func (*DbTxObject) QueryRow

func (t *DbTxObject) QueryRow(line string, args ...Object) Object

func (*DbTxObject) Rollback

func (t *DbTxObject) Rollback(line string, args ...Object) Object

func (*DbTxObject) Stmt

func (t *DbTxObject) Stmt(line string, args ...Object) Object

func (*DbTxObject) Type

func (t *DbTxObject) Type() ObjectType

type DbgInfo

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

type Debugger

type Debugger struct {
	SrcLines      []string
	SrcLinesCache map[string][]string
	DbgInfos      []*DbgInfo

	Functions map[string]*ast.FunctionLiteral

	//for breakpoint
	Breakpoints map[string]bool //key: 'filename:line'

	Node  ast.Node
	Scope *Scope

	Stepping bool
	// contains filtered or unexported fields
}
var Dbg *Debugger

func NewDebugger

func NewDebugger() *Debugger

func (*Debugger) AddBP

func (d *Debugger) AddBP(filename string, line int)

Add a breakpoint at source line

func (*Debugger) CanStop

func (d *Debugger) CanStop() bool

Check if node can be stopped, some nodes cannot be stopped, e.g. 'InfixExpression', 'IntegerLiteral'

func (*Debugger) DelBP

func (d *Debugger) DelBP(filename string, line int)

Delete a breakpoint at source line

func (*Debugger) IsBP

func (d *Debugger) IsBP(filename string, line int) bool

Check if a source line is at a breakpoint

func (*Debugger) MessageReceived

func (d *Debugger) MessageReceived(msg message.Message)

func (*Debugger) ProcessCommand

func (d *Debugger) ProcessCommand()

func (*Debugger) SetDbgInfos

func (d *Debugger) SetDbgInfos(dbgInfos [][]ast.Node)

func (*Debugger) SetFunctions

func (d *Debugger) SetFunctions(functions map[string]*ast.FunctionLiteral)

func (*Debugger) SetNodeAndScope

func (d *Debugger) SetNodeAndScope(node ast.Node, scope *Scope)

func (*Debugger) ShowBanner

func (d *Debugger) ShowBanner()

type Decimal

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

Decimal represents a fixed-point decimal. It is immutable. number = value * 10 ^ exp

func Avg

func Avg(first Decimal, rest ...Decimal) Decimal

Avg returns the average value of the provided first and rest Decimals

func Max

func Max(first Decimal, rest ...Decimal) Decimal

Max returns the largest Decimal that was passed in the arguments.

To call this function with an array, you must do:

Max(arr[0], arr[1:]...)

This makes it harder to accidentally call Max with 0 arguments.

func Min

func Min(first Decimal, rest ...Decimal) Decimal

Min returns the smallest Decimal that was passed in the arguments.

To call this function with an array, you must do:

Min(arr[0], arr[1:]...)

This makes it harder to accidentally call Min with 0 arguments.

func NewDec

func NewDec(value int64, exp int32) Decimal

NewDec returns a new fixed-point decimal, value * 10 ^ exp.

func NewFromFloat

func NewFromFloat(value float64) Decimal

NewFromFloat converts a float64 to Decimal.

Example:

NewFromFloat(123.45678901234567).String() // output: "123.4567890123456"
NewFromFloat(.00000000000000001).String() // output: "0.00000000000000001"

NOTE: this will panic on NaN, +/-inf

func NewFromFloatWithExponent

func NewFromFloatWithExponent(value float64, exp int32) Decimal

NewFromFloatWithExponent converts a float64 to Decimal, with an arbitrary number of fractional digits.

Example:

NewFromFloatWithExponent(123.456, -2).String() // output: "123.46"

func NewFromInt

func NewFromInt(value int64) Decimal

func NewFromString

func NewFromString(value string) (Decimal, error)

NewFromString returns a new Decimal from a string representation.

Example:

d, err := NewFromString("-123.45")
d2, err := NewFromString(".0001")

func NewFromUInt

func NewFromUInt(value uint64) Decimal

func Sum

func Sum(first Decimal, rest ...Decimal) Decimal

Sum returns the combined total of the provided first and rest Decimals

func (Decimal) Abs

func (d Decimal) Abs() Decimal

Abs returns the absolute value of the decimal.

func (Decimal) Add

func (d Decimal) Add(d2 Decimal) Decimal

Add returns d + d2.

func (Decimal) Ceil

func (d Decimal) Ceil() Decimal

Ceil returns the nearest integer value greater than or equal to d.

func (Decimal) Cmp

func (d Decimal) Cmp(d2 Decimal) int

Cmp compares the numbers represented by d and d2 and returns:

-1 if d <  d2
 0 if d == d2
+1 if d >  d2

func (Decimal) Coefficient

func (d Decimal) Coefficient() *big.Int

Coefficient returns the coefficient of the decimal. It is scaled by 10^Exponent()

func (Decimal) Div

func (d Decimal) Div(d2 Decimal) Decimal

Div returns d / d2. If it doesn't divide exactly, the result will have DivisionPrecision digits after the decimal point.

func (Decimal) DivRound

func (d Decimal) DivRound(d2 Decimal, precision int32) Decimal

DivRound divides and rounds to a given precision i.e. to an integer multiple of 10^(-precision)

for a positive quotient digit 5 is rounded up, away from 0
if the quotient is negative then digit 5 is rounded down, away from 0

Note that precision<0 is allowed as input.

func (Decimal) Equal

func (d Decimal) Equal(d2 Decimal) bool

Equal returns whether the numbers represented by d and d2 are equal.

func (Decimal) Equals

func (d Decimal) Equals(d2 Decimal) bool

Equals is deprecated, please use Equal method instead

func (Decimal) Exponent

func (d Decimal) Exponent() int32

Exponent returns the exponent, or scale component of the decimal.

func (Decimal) Float64

func (d Decimal) Float64() (f float64, exact bool)

Float64 returns the nearest float64 value for d and a bool indicating whether f represents d exactly. For more details, see the documentation for big.Rat.Float64

func (Decimal) Floor

func (d Decimal) Floor() Decimal

Floor returns the nearest integer value less than or equal to d.

func (Decimal) GreaterThan

func (d Decimal) GreaterThan(d2 Decimal) bool

GreaterThan (GT) returns true when d is greater than d2.

func (Decimal) GreaterThanOrEqual

func (d Decimal) GreaterThanOrEqual(d2 Decimal) bool

GreaterThanOrEqual (GTE) returns true when d is greater than or equal to d2.

func (Decimal) IntPart

func (d Decimal) IntPart() int64

IntPart returns the integer component of the decimal.

func (Decimal) LessThan

func (d Decimal) LessThan(d2 Decimal) bool

LessThan (LT) returns true when d is less than d2.

func (Decimal) LessThanOrEqual

func (d Decimal) LessThanOrEqual(d2 Decimal) bool

LessThanOrEqual (LTE) returns true when d is less than or equal to d2.

func (Decimal) MarshalJSON

func (d Decimal) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Decimal) Mod

func (d Decimal) Mod(d2 Decimal) Decimal

Mod returns d % d2.

func (Decimal) Mul

func (d Decimal) Mul(d2 Decimal) Decimal

Mul returns d * d2.

func (Decimal) Neg

func (d Decimal) Neg() Decimal

Neg returns -d.

func (Decimal) Pow

func (d Decimal) Pow(d2 Decimal) Decimal

Pow returns d to the power d2

func (Decimal) QuoRem

func (d Decimal) QuoRem(d2 Decimal, precision int32) (Decimal, Decimal)

QuoRem does divsion with remainder d.QuoRem(d2,precision) returns quotient q and remainder r such that

d = d2 * q + r, q an integer multiple of 10^(-precision)
0 <= r < abs(d2) * 10 ^(-precision) if d>=0
0 >= r > -abs(d2) * 10 ^(-precision) if d<0

Note that precision<0 is allowed as input.

func (Decimal) Rat

func (d Decimal) Rat() *big.Rat

Rat returns a rational number representation of the decimal.

func (Decimal) Round

func (d Decimal) Round(places int32) Decimal

Round rounds the decimal to places decimal places. If places < 0, it will round the integer part to the nearest 10^(-places).

Example:

NewFromFloat(5.45).Round(1).String() // output: "5.5"
NewFromFloat(545).Round(-1).String() // output: "550"

func (*Decimal) Scan

func (d *Decimal) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (Decimal) Sign

func (d Decimal) Sign() int

Sign returns:

-1 if d <  0
 0 if d == 0
+1 if d >  0

func (Decimal) String

func (d Decimal) String() string

String returns the string representation of the decimal with the fixed point.

Example:

d := NewDec(-12345, -3)
println(d.String())

Output:

-12.345

func (Decimal) StringFixed

func (d Decimal) StringFixed(places int32) string

StringFixed returns a rounded fixed-point string with places digits after the decimal point.

Example:

NewFromFloat(0).StringFixed(2) // output: "0.00"
NewFromFloat(0).StringFixed(0) // output: "0"
NewFromFloat(5.45).StringFixed(0) // output: "5"
NewFromFloat(5.45).StringFixed(1) // output: "5.5"
NewFromFloat(5.45).StringFixed(2) // output: "5.45"
NewFromFloat(5.45).StringFixed(3) // output: "5.450"
NewFromFloat(545).StringFixed(-1) // output: "550"

func (Decimal) StringScaled

func (d Decimal) StringScaled(exp int32) string

StringScaled first scales the decimal then calls .String() on it. NOTE: buggy, unintuitive, and DEPRECATED! Use StringFixed instead.

func (Decimal) Sub

func (d Decimal) Sub(d2 Decimal) Decimal

Sub returns d - d2.

func (Decimal) Truncate

func (d Decimal) Truncate(precision int32) Decimal

Truncate truncates off digits from the number, without rounding.

NOTE: precision is the last digit that will not be truncated (must be >= 0).

Example:

decimal.NewFromString("123.456").Truncate(2).String() // "123.45"

func (*Decimal) UnmarshalJSON

func (d *Decimal) UnmarshalJSON(decimalBytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Decimal) Value

func (d Decimal) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type DecimalObj

type DecimalObj struct {
	Number Decimal
	Valid  bool
}

func NewDecimalObj

func NewDecimalObj() *DecimalObj

func (*DecimalObj) Abs

func (d *DecimalObj) Abs(line string, args ...Object) Object

func (*DecimalObj) Add

func (d *DecimalObj) Add(line string, args ...Object) Object

func (*DecimalObj) Avg

func (d *DecimalObj) Avg(line string, args ...Object) Object

func (*DecimalObj) CallMethod

func (d *DecimalObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*DecimalObj) Ceil

func (d *DecimalObj) Ceil(line string, args ...Object) Object

func (*DecimalObj) Cmp

func (d *DecimalObj) Cmp(line string, args ...Object) Object

func (*DecimalObj) Div

func (d *DecimalObj) Div(line string, args ...Object) Object

func (*DecimalObj) DivRound

func (d *DecimalObj) DivRound(line string, args ...Object) Object

func (*DecimalObj) Equal

func (d *DecimalObj) Equal(line string, args ...Object) Object

func (*DecimalObj) Exponent

func (d *DecimalObj) Exponent(line string, args ...Object) Object

func (*DecimalObj) Float

func (d *DecimalObj) Float(line string, args ...Object) Object

func (*DecimalObj) Floor

func (d *DecimalObj) Floor(line string, args ...Object) Object

func (*DecimalObj) FromFloat

func (d *DecimalObj) FromFloat(line string, args ...Object) Object

func (*DecimalObj) FromFloatWithExponent

func (d *DecimalObj) FromFloatWithExponent(line string, args ...Object) Object

func (*DecimalObj) FromString

func (d *DecimalObj) FromString(line string, args ...Object) Object

func (*DecimalObj) GetDivisionPrecision

func (d *DecimalObj) GetDivisionPrecision(line string, args ...Object) Object

func (*DecimalObj) GetMarshalJSONWithoutQuotes

func (d *DecimalObj) GetMarshalJSONWithoutQuotes(line string, args ...Object) Object

func (*DecimalObj) GreaterThan

func (d *DecimalObj) GreaterThan(line string, args ...Object) Object

func (*DecimalObj) GreaterThanOrEqual

func (d *DecimalObj) GreaterThanOrEqual(line string, args ...Object) Object

func (*DecimalObj) Inspect

func (d *DecimalObj) Inspect() string

func (*DecimalObj) IntPart

func (d *DecimalObj) IntPart(line string, args ...Object) Object

func (*DecimalObj) LessThan

func (d *DecimalObj) LessThan(line string, args ...Object) Object

func (*DecimalObj) LessThanOrEqual

func (d *DecimalObj) LessThanOrEqual(line string, args ...Object) Object

func (*DecimalObj) MarshalJSON

func (d *DecimalObj) MarshalJSON() ([]byte, error)

Json marshal handling

func (*DecimalObj) Max

func (d *DecimalObj) Max(line string, args ...Object) Object

func (*DecimalObj) Min

func (d *DecimalObj) Min(line string, args ...Object) Object

func (*DecimalObj) Mod

func (d *DecimalObj) Mod(line string, args ...Object) Object

func (*DecimalObj) Mul

func (d *DecimalObj) Mul(line string, args ...Object) Object

func (*DecimalObj) Neg

func (d *DecimalObj) Neg(line string, args ...Object) Object

func (*DecimalObj) New

func (d *DecimalObj) New(line string, args ...Object) Object

func (*DecimalObj) Pow

func (d *DecimalObj) Pow(line string, args ...Object) Object

func (*DecimalObj) Round

func (d *DecimalObj) Round(line string, args ...Object) Object

func (*DecimalObj) Scan

func (d *DecimalObj) Scan(value interface{}) error

Implements sql's Scanner Interface. So when calling sql.Rows.Scan(xxx), or sql.Row.Scan(xxx), we could pass this object to `Scan` method

func (*DecimalObj) SetDivisionPrecision

func (d *DecimalObj) SetDivisionPrecision(line string, args ...Object) Object

func (*DecimalObj) SetMarshalJSONWithoutQuotes

func (d *DecimalObj) SetMarshalJSONWithoutQuotes(line string, args ...Object) Object

func (*DecimalObj) Sign

func (d *DecimalObj) Sign(line string, args ...Object) Object

func (*DecimalObj) String

func (d *DecimalObj) String(line string, args ...Object) Object

func (*DecimalObj) StringFixed

func (d *DecimalObj) StringFixed(line string, args ...Object) Object

func (*DecimalObj) StringScaled

func (d *DecimalObj) StringScaled(line string, args ...Object) Object

func (*DecimalObj) Sub

func (d *DecimalObj) Sub(line string, args ...Object) Object

func (*DecimalObj) Sum

func (d *DecimalObj) Sum(line string, args ...Object) Object

func (*DecimalObj) Truncate

func (d *DecimalObj) Truncate(line string, args ...Object) Object

func (*DecimalObj) Type

func (d *DecimalObj) Type() ObjectType

func (*DecimalObj) UnmarshalJSON

func (d *DecimalObj) UnmarshalJSON(b []byte) error

func (DecimalObj) Value

func (d DecimalObj) Value() (driver.Value, error)

Implements driver's Valuer Interface. So when calling sql.Exec(xx), we could pass this object to `Exec` method

type Enum

type Enum struct {
	Scope *Scope
}

func (*Enum) CallMethod

func (e *Enum) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Enum) GetName

func (e *Enum) GetName(line string, args ...Object) Object

func (*Enum) GetNames

func (e *Enum) GetNames(line string, args ...Object) Object

func (*Enum) GetValues

func (e *Enum) GetValues(line string, args ...Object) Object

func (*Enum) Inspect

func (e *Enum) Inspect() string

func (*Enum) Type

func (e *Enum) Type() ObjectType

type Error

type Error struct {
	Kind    int
	Message string
}

func (*Error) CallMethod

func (e *Error) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (Error) Error

func (e Error) Error() string

func (*Error) Inspect

func (e *Error) Inspect() string

func (*Error) Type

func (e *Error) Type() ObjectType

type FileInfoObj

type FileInfoObj struct {
	Info os.FileInfo
}

FileInfo Object

func (*FileInfoObj) CallMethod

func (fi *FileInfoObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*FileInfoObj) Inspect

func (fi *FileInfoObj) Inspect() string

func (*FileInfoObj) IsDir

func (fi *FileInfoObj) IsDir(line string, args ...Object) Object

func (*FileInfoObj) ModTime

func (fi *FileInfoObj) ModTime(line string, args ...Object) Object

func (*FileInfoObj) Mode

func (fi *FileInfoObj) Mode(line string, args ...Object) Object

func (*FileInfoObj) Name

func (fi *FileInfoObj) Name(line string, args ...Object) Object

func (*FileInfoObj) Size

func (fi *FileInfoObj) Size(line string, args ...Object) Object

func (*FileInfoObj) Type

func (fi *FileInfoObj) Type() ObjectType

type FileObject

type FileObject struct {
	File    *os.File
	Name    string
	Scanner *bufio.Scanner
	// contains filtered or unexported fields
}

func (*FileObject) CallMethod

func (f *FileObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*FileObject) Close

func (f *FileObject) Close(line string, args ...Object) Object

func (*FileObject) GetName

func (f *FileObject) GetName(line string, args ...Object) Object

func (*FileObject) IOWriter

func (f *FileObject) IOWriter() io.Writer

func (*FileObject) Inspect

func (f *FileObject) Inspect() string

func (*FileObject) Read

func (f *FileObject) Read(line string, args ...Object) Object

Note: This method will return three different values:

  1. nil - with error message (ERROR)
  2. nil - without error message (EOF)
  3. string - read string

func (*FileObject) ReadAt

func (f *FileObject) ReadAt(line string, args ...Object) Object

func (*FileObject) ReadLine

func (f *FileObject) ReadLine(line string, args ...Object) Object

func (*FileObject) ReadRune

func (f *FileObject) ReadRune(line string, args ...Object) Object

func (*FileObject) Seek

func (f *FileObject) Seek(line string, args ...Object) Object

func (*FileObject) Stat

func (f *FileObject) Stat(line string, args ...Object) Object

func (*FileObject) Sync

func (f *FileObject) Sync(line string, args ...Object) Object

func (*FileObject) Truncate

func (f *FileObject) Truncate(line string, args ...Object) Object

func (*FileObject) Type

func (f *FileObject) Type() ObjectType

func (*FileObject) Write

func (f *FileObject) Write(line string, args ...Object) Object

func (*FileObject) WriteAt

func (f *FileObject) WriteAt(line string, args ...Object) Object

func (*FileObject) WriteLine

func (f *FileObject) WriteLine(line string, args ...Object) Object

func (*FileObject) WriteString

func (f *FileObject) WriteString(line string, args ...Object) Object

type FilePathObj

type FilePathObj struct{}

func NewFilePathObj

func NewFilePathObj() *FilePathObj

func (*FilePathObj) Abs

func (f *FilePathObj) Abs(line string, args ...Object) Object

func (*FilePathObj) Base

func (f *FilePathObj) Base(line string, args ...Object) Object

func (*FilePathObj) CallMethod

func (f *FilePathObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*FilePathObj) Clean

func (f *FilePathObj) Clean(line string, args ...Object) Object

func (*FilePathObj) Dir

func (f *FilePathObj) Dir(line string, args ...Object) Object
func (f *FilePathObj) EvalSymlinks(line string, args ...Object) Object

func (*FilePathObj) Ext

func (f *FilePathObj) Ext(line string, args ...Object) Object

func (*FilePathObj) FromSlash

func (f *FilePathObj) FromSlash(line string, args ...Object) Object

func (*FilePathObj) Glob

func (f *FilePathObj) Glob(line string, args ...Object) Object

func (*FilePathObj) HasPrefix

func (f *FilePathObj) HasPrefix(line string, args ...Object) Object

func (*FilePathObj) Inspect

func (f *FilePathObj) Inspect() string

func (*FilePathObj) IsAbs

func (f *FilePathObj) IsAbs(line string, args ...Object) Object

func (*FilePathObj) Join

func (f *FilePathObj) Join(line string, args ...Object) Object

func (*FilePathObj) Match

func (f *FilePathObj) Match(line string, args ...Object) Object

func (*FilePathObj) Rel

func (f *FilePathObj) Rel(line string, args ...Object) Object

func (*FilePathObj) Split

func (f *FilePathObj) Split(line string, args ...Object) Object

func (*FilePathObj) SplitList

func (f *FilePathObj) SplitList(line string, args ...Object) Object

func (*FilePathObj) ToSlash

func (f *FilePathObj) ToSlash(line string, args ...Object) Object

func (*FilePathObj) Type

func (f *FilePathObj) Type() ObjectType

func (*FilePathObj) VolumeName

func (f *FilePathObj) VolumeName(line string, args ...Object) Object

func (*FilePathObj) Walk

func (f *FilePathObj) Walk(scope *Scope, line string, args ...Object) Object

type FlagObj

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

func NewFlagObj

func NewFlagObj() *FlagObj

func (*FlagObj) Arg

func (f *FlagObj) Arg(line string, args ...Object) Object

func (*FlagObj) Args

func (f *FlagObj) Args(line string, args ...Object) Object

func (*FlagObj) Bool

func (f *FlagObj) Bool(line string, args ...Object) Object

func (*FlagObj) CallMethod

func (f *FlagObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*FlagObj) Float

func (f *FlagObj) Float(line string, args ...Object) Object

func (*FlagObj) Inspect

func (f *FlagObj) Inspect() string

func (*FlagObj) Int

func (f *FlagObj) Int(line string, args ...Object) Object

func (*FlagObj) IsSet

func (f *FlagObj) IsSet(line string, args ...Object) Object

func (*FlagObj) NArg

func (f *FlagObj) NArg(line string, args ...Object) Object

func (*FlagObj) NFlag

func (f *FlagObj) NFlag(line string, args ...Object) Object

func (*FlagObj) Parse

func (f *FlagObj) Parse(line string, args ...Object) Object

func (*FlagObj) Parsed

func (f *FlagObj) Parsed(line string, args ...Object) Object

func (*FlagObj) PrintDefaults

func (f *FlagObj) PrintDefaults(line string, args ...Object) Object

func (*FlagObj) Set

func (f *FlagObj) Set(line string, args ...Object) Object

func (*FlagObj) String

func (f *FlagObj) String(line string, args ...Object) Object

func (*FlagObj) Type

func (f *FlagObj) Type() ObjectType

func (*FlagObj) UInt

func (f *FlagObj) UInt(line string, args ...Object) Object

type Float

type Float struct {
	Float64 float64
	Valid   bool
}

func NewFloat

func NewFloat(f float64) *Float

Returns a valid Float Object, that is Valid=true

func (*Float) CallMethod

func (f *Float) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Float) Ceil

func (f *Float) Ceil(line string, args ...Object) Object

func (*Float) Floor

func (f *Float) Floor(line string, args ...Object) Object

func (*Float) Inspect

func (f *Float) Inspect() string

func (*Float) IsValid

func (f *Float) IsValid(line string, args ...Object) Object

func (*Float) MarshalJSON

func (f *Float) MarshalJSON() ([]byte, error)

func (*Float) Pow

func (f *Float) Pow(line string, args ...Object) Object

func (*Float) Round

func (f *Float) Round(line string, args ...Object) Object

func (*Float) Scan

func (f *Float) Scan(value interface{}) error

func (*Float) SetValid

func (f *Float) SetValid(line string, args ...Object) Object

func (*Float) Sqrt

func (f *Float) Sqrt(line string, args ...Object) Object

func (*Float) Str

func (f *Float) Str(line string, args ...Object) Object

func (*Float) Trunc

func (f *Float) Trunc(line string, args ...Object) Object

func (*Float) Type

func (f *Float) Type() ObjectType

func (*Float) UnmarshalJSON

func (f *Float) UnmarshalJSON(b []byte) error

func (Float) Value

func (f Float) Value() (driver.Value, error)

type Float64Slice

type Float64Slice struct {
	FloatArr  []float64
	SortOrder Ordering
}

Float64Slice attaches the methods of Interface to []float64, sorting in ascending/descending order.

func (Float64Slice) Len

func (p Float64Slice) Len() int

func (Float64Slice) Less

func (p Float64Slice) Less(i, j int) bool

func (Float64Slice) Sort

func (p Float64Slice) Sort()

Sort is a convenience method.

func (Float64Slice) Swap

func (p Float64Slice) Swap(i, j int)

type FmtObj

type FmtObj struct {
}

func NewFmtObj

func NewFmtObj() *FmtObj

func (*FmtObj) CallMethod

func (f *FmtObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*FmtObj) Errorf

func (f *FmtObj) Errorf(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Fprint

func (f *FmtObj) Fprint(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Fprintf

func (f *FmtObj) Fprintf(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Fprintln

func (f *FmtObj) Fprintln(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Inspect

func (f *FmtObj) Inspect() string

func (*FmtObj) Print

func (f *FmtObj) Print(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Printf

func (f *FmtObj) Printf(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Println

func (f *FmtObj) Println(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Sprint

func (f *FmtObj) Sprint(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Sprintf

func (f *FmtObj) Sprintf(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Sprintln

func (f *FmtObj) Sprintln(line string, scope *Scope, args ...Object) Object

func (*FmtObj) Type

func (f *FmtObj) Type() ObjectType

type Formatter

type Formatter struct {
	Obj Object
}

This `Formatter` struct is mainly used to encapsulate golang `fmt` package's `Formatter` interface. When we implement this interface, our `Object` could be directed passed to fmt.Printf(xxx)

func (*Formatter) Format

func (ft *Formatter) Format(s fmt.State, verb rune)

type Function

type Function struct {
	Literal     *ast.FunctionLiteral
	Variadic    bool
	Scope       *Scope
	Instance    *ObjectInstance //For use with class functions
	Annotations []*ObjectInstance

	Async bool
}

func (*Function) CallMethod

func (f *Function) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Function) Inspect

func (f *Function) Inspect() string

func (*Function) Type

func (r *Function) Type() ObjectType

type GoFuncObject

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

wrapper for go functions

func NewGoFuncObject

func NewGoFuncObject(fname string, fn interface{}) *GoFuncObject

func (*GoFuncObject) CallMethod

func (gfn *GoFuncObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*GoFuncObject) Inspect

func (gfn *GoFuncObject) Inspect() string

func (*GoFuncObject) Type

func (gfn *GoFuncObject) Type() ObjectType

type GoObject

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

Wrapper for go object

func NewGoObject

func NewGoObject(obj interface{}) *GoObject

func (*GoObject) CallMethod

func (gobj *GoObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*GoObject) Equal

func (gobj *GoObject) Equal(another Object) bool

func (*GoObject) Inspect

func (gobj *GoObject) Inspect() string

func (*GoObject) Type

func (gobj *GoObject) Type() ObjectType

type GroupObj

type GroupObj struct {
	KeyObj Object
	Group  []Object
}

Group is a type that is used to store the result of GroupBy method.

func (*GroupObj) CallMethod

func (g *GroupObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*GroupObj) Inspect

func (g *GroupObj) Inspect() string

func (*GroupObj) Key

func (g *GroupObj) Key(line string, args ...Object) Object

func (*GroupObj) Type

func (g *GroupObj) Type() ObjectType

func (*GroupObj) Value

func (g *GroupObj) Value(line string, args ...Object) Object

type Hash

type Hash struct {
	Order []HashKey
	Pairs map[HashKey]HashPair
}

func NewHash

func NewHash() *Hash

func (*Hash) CallMethod

func (h *Hash) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Hash) Clear

func (h *Hash) Clear(line string, args ...Object) Object

func (*Hash) Exists

func (h *Hash) Exists(line string, args ...Object) Object

func (*Hash) Filter

func (h *Hash) Filter(line string, scope *Scope, args ...Object) Object

func (*Hash) Get

func (h *Hash) Get(line string, args ...Object) Object

func (*Hash) GetPath

func (h *Hash) GetPath(line string, args ...Object) Object
    Code copied from "go-json-map" with modifications

    document = {
        one: {
            "two": {
                "three": [1, 2, 3,]
            },
            "four": {
                "five": [ 11, 22, 33,]
            },
        },
    }
	prop = document.getPath("one.two.three[0]")
	println(prop) // prop => 1

	prop= document.getPath("one.two.three")
	println(prop) // prop => [1, 2, 3]

func (*Hash) Index

func (h *Hash) Index(line string, args ...Object) Object

func (*Hash) Inspect

func (h *Hash) Inspect() string

func (*Hash) Keys

func (h *Hash) Keys(line string, args ...Object) Object

func (*Hash) Len

func (h *Hash) Len(line string, args ...Object) Object

func (*Hash) Map

func (h *Hash) Map(line string, scope *Scope, args ...Object) Object

func (*Hash) MarshalJSON

func (h *Hash) MarshalJSON() ([]byte, error)

Json marshal handling

func (*Hash) Merge

func (h *Hash) Merge(line string, args ...Object) Object

func (*Hash) Pop

func (h *Hash) Pop(line string, args ...Object) Object

func (*Hash) Push

func (h *Hash) Push(line string, args ...Object) Object

func (*Hash) Type

func (h *Hash) Type() ObjectType

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(b []byte) error

func (*Hash) Values

func (h *Hash) Values(line string, args ...Object) Object

type HashKey

type HashKey struct {
	Type  ObjectType
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

Whether the Object can be used as hash's key

type HttpClient

type HttpClient struct {
	Client *http.Client
}

HTTP Client object

func (*HttpClient) CallMethod

func (h *HttpClient) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpClient) Do

func (h *HttpClient) Do(line string, args ...Object) Object

func (*HttpClient) Get

func (h *HttpClient) Get(line string, args ...Object) Object

func (*HttpClient) Head

func (h *HttpClient) Head(line string, args ...Object) Object

func (*HttpClient) Inspect

func (h *HttpClient) Inspect() string

func (*HttpClient) Post

func (h *HttpClient) Post(line string, args ...Object) Object

func (*HttpClient) PostForm

func (h *HttpClient) PostForm(line string, args ...Object) Object

func (*HttpClient) Type

func (h *HttpClient) Type() ObjectType

type HttpHeader

type HttpHeader struct {
	Header http.Header
}

HTTP Header object

func (*HttpHeader) Add

func (h *HttpHeader) Add(line string, args ...Object) Object

func (*HttpHeader) CallMethod

func (h *HttpHeader) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpHeader) Del

func (h *HttpHeader) Del(line string, args ...Object) Object

func (*HttpHeader) Get

func (h *HttpHeader) Get(line string, args ...Object) Object

func (*HttpHeader) Inspect

func (h *HttpHeader) Inspect() string

func (*HttpHeader) Set

func (h *HttpHeader) Set(line string, args ...Object) Object

func (*HttpHeader) Type

func (h *HttpHeader) Type() ObjectType

func (*HttpHeader) Write

func (h *HttpHeader) Write(line string, args ...Object) Object

type HttpObj

type HttpObj struct {
}

func (*HttpObj) CallMethod

func (h *HttpObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpObj) Get

func (h *HttpObj) Get(line string, args ...Object) Object

func (*HttpObj) Handle

func (h *HttpObj) Handle(line string, scope *Scope, args ...Object) Object

func (*HttpObj) HandleFunc

func (h *HttpObj) HandleFunc(line string, scope *Scope, args ...Object) Object

func (*HttpObj) Head

func (h *HttpObj) Head(line string, args ...Object) Object

func (*HttpObj) Inspect

func (h *HttpObj) Inspect() string

func (*HttpObj) ListenAndServe

func (h *HttpObj) ListenAndServe(line string, scope *Scope, args ...Object) Object

func (*HttpObj) NewRequest

func (h *HttpObj) NewRequest(line string, args ...Object) Object

func (*HttpObj) NewServer

func (h *HttpObj) NewServer(line string, args ...Object) Object

func (*HttpObj) Post

func (h *HttpObj) Post(line string, args ...Object) Object

func (*HttpObj) PostForm

func (h *HttpObj) PostForm(line string, args ...Object) Object

func (*HttpObj) Redirect

func (h *HttpObj) Redirect(line string, args ...Object) Object

func (*HttpObj) Type

func (h *HttpObj) Type() ObjectType

type HttpRequest

type HttpRequest struct {
	Request *http.Request
}

HTTP Request object

func (*HttpRequest) CallMethod

func (h *HttpRequest) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpRequest) FormValue

func (h *HttpRequest) FormValue(line string, args ...Object) Object

func (*HttpRequest) Header

func (h *HttpRequest) Header(line string, args ...Object) Object

func (*HttpRequest) Inspect

func (h *HttpRequest) Inspect() string

func (*HttpRequest) Method

func (h *HttpRequest) Method(line string, args ...Object) Object

func (*HttpRequest) Type

func (h *HttpRequest) Type() ObjectType

func (*HttpRequest) Write

func (h *HttpRequest) Write(line string, args ...Object) Object

type HttpResponse

type HttpResponse struct {
	Response *http.Response
}

HTTP Response object

func (*HttpResponse) CallMethod

func (h *HttpResponse) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpResponse) CloseBody

func (h *HttpResponse) CloseBody(line string, args ...Object) Object

func (*HttpResponse) Header

func (h *HttpResponse) Header(line string, args ...Object) Object

func (*HttpResponse) Inspect

func (h *HttpResponse) Inspect() string

func (*HttpResponse) ReadAll

func (h *HttpResponse) ReadAll(line string, args ...Object) Object

func (*HttpResponse) Type

func (h *HttpResponse) Type() ObjectType

type HttpResponseWriter

type HttpResponseWriter struct {
	Writer http.ResponseWriter
}

HTTP ResponseWriter object

func (*HttpResponseWriter) CallMethod

func (h *HttpResponseWriter) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpResponseWriter) Header

func (h *HttpResponseWriter) Header(line string, args ...Object) Object

func (*HttpResponseWriter) IOWriter

func (h *HttpResponseWriter) IOWriter() io.Writer

func (*HttpResponseWriter) Inspect

func (h *HttpResponseWriter) Inspect() string

func (*HttpResponseWriter) Type

func (h *HttpResponseWriter) Type() ObjectType

func (*HttpResponseWriter) Write

func (h *HttpResponseWriter) Write(line string, args ...Object) Object

func (*HttpResponseWriter) WriteHeader

func (h *HttpResponseWriter) WriteHeader(line string, args ...Object) Object

func (*HttpResponseWriter) WriteJson

func (h *HttpResponseWriter) WriteJson(line string, args ...Object) Object

type HttpServer

type HttpServer struct {
	Server *http.Server
}

HTTP Server object

func (*HttpServer) CallMethod

func (h *HttpServer) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*HttpServer) Inspect

func (h *HttpServer) Inspect() string

func (*HttpServer) ListenAndServe

func (h *HttpServer) ListenAndServe(line string, args ...Object) Object

func (*HttpServer) SetKeepAlivesEnabled

func (h *HttpServer) SetKeepAlivesEnabled(line string, args ...Object) Object

func (*HttpServer) SetMaxHeaderBytes

func (h *HttpServer) SetMaxHeaderBytes(line string, args ...Object) Object

func (*HttpServer) SetReadTimeout

func (h *HttpServer) SetReadTimeout(line string, args ...Object) Object

func (*HttpServer) SetWriteTimeout

func (h *HttpServer) SetWriteTimeout(line string, args ...Object) Object

func (*HttpServer) Type

func (h *HttpServer) Type() ObjectType

type IOUtilObj

type IOUtilObj struct{}

func (*IOUtilObj) CallMethod

func (i *IOUtilObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*IOUtilObj) Inspect

func (i *IOUtilObj) Inspect() string

func (*IOUtilObj) ReadAll

func (i *IOUtilObj) ReadAll(line string, args ...Object) Object

func (*IOUtilObj) ReadDir

func (i *IOUtilObj) ReadDir(line string, args ...Object) Object

func (*IOUtilObj) ReadFile

func (i *IOUtilObj) ReadFile(line string, args ...Object) Object

func (*IOUtilObj) TempDir

func (i *IOUtilObj) TempDir(line string, args ...Object) Object

func (*IOUtilObj) TempFile

func (i *IOUtilObj) TempFile(line string, args ...Object) Object

func (*IOUtilObj) Type

func (i *IOUtilObj) Type() ObjectType

func (*IOUtilObj) WriteFile

func (i *IOUtilObj) WriteFile(line string, args ...Object) Object

type ImportedObject

type ImportedObject struct {
	Name  string
	Scope *Scope
}

func (*ImportedObject) CallMethod

func (io *ImportedObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ImportedObject) Inspect

func (io *ImportedObject) Inspect() string

func (*ImportedObject) Type

func (io *ImportedObject) Type() ObjectType

type IntSlice

type IntSlice struct {
	IntArr    []int64
	SortOrder Ordering
}

IntSlice attaches the methods of Interface to []int, sorting in ascending/descending order.

func (IntSlice) Len

func (p IntSlice) Len() int

func (IntSlice) Less

func (p IntSlice) Less(i, j int) bool

func (IntSlice) Sort

func (p IntSlice) Sort()

Sort is a convenience method.

func (IntSlice) Swap

func (p IntSlice) Swap(i, j int)

type Integer

type Integer struct {
	Int64 int64
	Valid bool
}

func NewInteger

func NewInteger(i int64) *Integer

Returns a valid Integer Object, that is Valid=true

func (*Integer) CallMethod

func (i *Integer) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Integer) Downto

func (i *Integer) Downto(line string, args ...Object) Object

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) IsEven

func (i *Integer) IsEven(line string, args ...Object) Object

func (*Integer) IsOdd

func (i *Integer) IsOdd(line string, args ...Object) Object

func (*Integer) IsValid

func (i *Integer) IsValid(line string, args ...Object) Object

func (*Integer) MarshalJSON

func (i *Integer) MarshalJSON() ([]byte, error)

Json marshal handling

func (*Integer) Next

func (i *Integer) Next(line string, args ...Object) Object

func (*Integer) Prev

func (i *Integer) Prev(line string, args ...Object) Object

func (*Integer) Scan

func (i *Integer) Scan(value interface{}) error

Implements sql's Scanner Interface. So when calling sql.Rows.Scan(xxx), or sql.Row.Scan(xxx), we could pass this object to `Scan` method

func (*Integer) SetValid

func (i *Integer) SetValid(line string, args ...Object) Object

func (*Integer) Str

func (i *Integer) Str(line string, args ...Object) Object

func (*Integer) Type

func (i *Integer) Type() ObjectType

func (*Integer) UnmarshalJSON

func (i *Integer) UnmarshalJSON(b []byte) error

func (*Integer) Upto

func (i *Integer) Upto(line string, args ...Object) Object

func (Integer) Value

func (i Integer) Value() (driver.Value, error)

Implements driver's Valuer Interface. So when calling sql.Exec(xx), we could pass this object to `Exec` method

type Interpolable

type Interpolable interface {
	Interpolate(scope *Scope)
}

type InterpolatedString

type InterpolatedString struct {
	String      *String
	RawValue    string
	Expressions map[byte]ast.Expression
}

func (*InterpolatedString) CallMethod

func (is *InterpolatedString) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*InterpolatedString) Inspect

func (is *InterpolatedString) Inspect() string

func (*InterpolatedString) Interpolate

func (is *InterpolatedString) Interpolate(scope *Scope)

func (*InterpolatedString) Type

func (is *InterpolatedString) Type() ObjectType

type Iterable

type Iterable interface {
	// contains filtered or unexported methods
}

Whether the Object is iterable (HASH, ARRAY, RANGE, STRING, TUPLE, Some of the GoObject)

type Iterator

type Iterator func() (item Object, ok *Boolean)

Iterator is an alias for function to iterate over data.

type Json

type Json struct {
}

func (*Json) CallMethod

func (j *Json) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Json) Indent

func (j *Json) Indent(line string, args ...Object) Object

func (*Json) Inspect

func (j *Json) Inspect() string

func (*Json) Marshal

func (j *Json) Marshal(line string, args ...Object) Object

func (*Json) Read

func (j *Json) Read(line string, args ...Object) Object

func (*Json) ReadFile

func (j *Json) ReadFile(line string, args ...Object) Object

func (*Json) Type

func (j *Json) Type() ObjectType

func (*Json) UnMarshal

func (j *Json) UnMarshal(line string, args ...Object) Object

func (*Json) WriteFile

func (j *Json) WriteFile(line string, args ...Object) Object

type KeyValueObj

type KeyValueObj struct {
	KeyObj   Object
	ValueObj Object
}

KeyValue is a type that is used to iterate over a map (if query is created from a map). This type is also used by ToMap() method to output result of a query into a map.

func (*KeyValueObj) CallMethod

func (kv *KeyValueObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*KeyValueObj) Inspect

func (kv *KeyValueObj) Inspect() string

func (*KeyValueObj) Key

func (kv *KeyValueObj) Key(line string, args ...Object) Object

func (*KeyValueObj) Type

func (kv *KeyValueObj) Type() ObjectType

func (*KeyValueObj) Value

func (kv *KeyValueObj) Value(line string, args ...Object) Object

type LinqObj

type LinqObj struct {
	Query        Query
	OrderedQuery OrderedQuery
}

func NewLinqObj

func NewLinqObj() *LinqObj

func (*LinqObj) Aggregate

func (lq *LinqObj) Aggregate(line string, scope *Scope, args ...Object) Object

Aggregate applies an accumulator function over a sequence.

Aggregate method makes it simple to perform a calculation over a sequence of values. This method works by calling f() one time for each element in source except the first one. Each time f() is called, Aggregate passes both the element from the sequence and an aggregated value (as the first argument to f()). The first element of source is used as the initial aggregate value. The result of f() replaces the previous aggregated value.

Aggregate returns the final result of f().

func (*LinqObj) AggregateWithSeed

func (lq *LinqObj) AggregateWithSeed(line string, scope *Scope, args ...Object) Object

AggregateWithSeed applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

Aggregate method makes it simple to perform a calculation over a sequence of values. This method works by calling f() one time for each element in source except the first one. Each time f() is called, Aggregate passes both the element from the sequence and an aggregated value (as the first argument to f()). The value of the seed parameter is used as the initial aggregate value. The result of f() replaces the previous aggregated value.

Aggregate returns the final result of f().

func (*LinqObj) AggregateWithSeedBy

func (lq *LinqObj) AggregateWithSeedBy(line string, scope *Scope, args ...Object) Object

AggregateWithSeedBy applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.

Aggregate method makes it simple to perform a calculation over a sequence of values. This method works by calling f() one time for each element in source. Each time func is called, Aggregate passes both the element from the sequence and an aggregated value (as the first argument to func). The value of the seed parameter is used as the initial aggregate value. The result of func replaces the previous aggregated value.

The final result of func is passed to resultSelector to obtain the final result of Aggregate.

func (*LinqObj) All

func (lq *LinqObj) All(line string, scope *Scope, args ...Object) Object

All determines whether all elements of a collection satisfy a condition.

func (*LinqObj) Any

func (lq *LinqObj) Any(line string, args ...Object) Object

Any determines whether any element of a collection exists.

func (*LinqObj) AnyWith

func (lq *LinqObj) AnyWith(line string, scope *Scope, args ...Object) Object

func (*LinqObj) Append

func (lq *LinqObj) Append(line string, args ...Object) Object

Append inserts an item to the end of a collection, so it becomes the last item.

func (*LinqObj) Average

func (lq *LinqObj) Average(line string, args ...Object) Object

Average computes the average of a collection of numeric values.

func (*LinqObj) CallMethod

func (lq *LinqObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*LinqObj) Concat

func (lq *LinqObj) Concat(line string, args ...Object) Object

Concat concatenates two collections.

The Concat method differs from the Union method because the Concat method returns all the original elements in the input sequences. The Union method returns only unique elements.

func (*LinqObj) Contains

func (lq *LinqObj) Contains(line string, args ...Object) Object

Contains determines whether a collection contains a specified element.

func (*LinqObj) Count

func (lq *LinqObj) Count(line string, args ...Object) Object

Count returns the number of elements in a collection.

func (*LinqObj) CountWith

func (lq *LinqObj) CountWith(line string, scope *Scope, args ...Object) Object

CountWith returns a number that represents how many elements in the specified collection satisfy a condition.

func (*LinqObj) Distinct

func (lq *LinqObj) Distinct(line string, args ...Object) Object

Distinct method returns distinct elements from a collection. The result is an unordered collection that contains no duplicate values.

func (*LinqObj) DistinctBy

func (lq *LinqObj) DistinctBy(line string, scope *Scope, args ...Object) Object

DistinctBy method returns distinct elements from a collection. This method executes selector function for each element to determine a value to compare. The result is an unordered collection that contains no duplicate values.

func (*LinqObj) Except

func (lq *LinqObj) Except(line string, args ...Object) Object

Except produces the set difference of two sequences. The set difference is the members of the first sequence that don't appear in the second sequence.

func (*LinqObj) ExceptBy

func (lq *LinqObj) ExceptBy(line string, scope *Scope, args ...Object) Object

ExceptBy invokes a transform function on each element of a collection and produces the set difference of two sequences. The set difference is the members of the first sequence that don't appear in the second sequence.

func (*LinqObj) First

func (lq *LinqObj) First(line string, args ...Object) Object

Last returns the first element of a collection.

func (*LinqObj) FirstWith

func (lq *LinqObj) FirstWith(line string, scope *Scope, args ...Object) Object

FirstWith returns the first element of a collection that satisfies a specified condition.

func (*LinqObj) ForEach

func (lq *LinqObj) ForEach(line string, scope *Scope, args ...Object) Object

ForEach performs the specified action on each element of a collection.

func (*LinqObj) ForEachIndexed

func (lq *LinqObj) ForEachIndexed(line string, scope *Scope, args ...Object) Object

ForEachIndexed performs the specified action on each element of a collection.

func (*LinqObj) From

func (lq *LinqObj) From(line string, scope *Scope, args ...Object) Object

From initializes a linq query with passed slice, array or map as the source. String, channel or struct implementing Iterable interface can be used as an input. In this case From delegates it to FromString, FromChannel and FromIterable internally.

func (*LinqObj) FromInner

func (lq *LinqObj) FromInner(line string, scope *Scope, args ...Object) Object

func (*LinqObj) FromQuery

func (lq *LinqObj) FromQuery(line string, scope *Scope, args ...Object) Object

func (*LinqObj) GroupBy

func (lq *LinqObj) GroupBy(line string, scope *Scope, args ...Object) Object

GroupBy method groups the elements of a collection according to a specified key selector function and projects the elements for each group by using a specified function.

func (*LinqObj) GroupBy2

func (lq *LinqObj) GroupBy2(line string, scope *Scope, args ...Object) Object

func (*LinqObj) Inspect

func (lq *LinqObj) Inspect() string

func (*LinqObj) Intersect

func (lq *LinqObj) Intersect(line string, args ...Object) Object

Intersect produces the set intersection of the source collection and the provided input collection. The intersection of two sets A and B is defined as the set that contains all the elements of A that also appear in B, but no other elements.

func (*LinqObj) IntersectBy

func (lq *LinqObj) IntersectBy(line string, scope *Scope, args ...Object) Object

IntersectBy produces the set intersection of the source collection and the provided input collection. The intersection of two sets A and B is defined as the set that contains all the elements of A that also appear in B, but no other elements.

IntersectBy invokes a transform function on each element of both collections.

func (*LinqObj) Join

func (lq *LinqObj) Join(line string, scope *Scope, args ...Object) Object

Join correlates the elements of two collection based on matching keys.

A join refers to the operation of correlating the elements of two sources of information based on a common key. Join brings the two information sources and the keys by which they are matched together in one method call. This differs from the use of SelectMany, which requires more than one method call to perform the same operation.

Join preserves the order of the elements of outer collection, and for each of these elements, the order of the matching elements of inner.

func (*LinqObj) Last

func (lq *LinqObj) Last(line string, args ...Object) Object

Last returns the last element of a collection.

func (*LinqObj) LastWith

func (lq *LinqObj) LastWith(line string, scope *Scope, args ...Object) Object

LastWith returns the last element of a collection that satisfies a specified condition.

func (*LinqObj) Let

func (lq *LinqObj) Let(line string, scope *Scope, args ...Object) Object

func (*LinqObj) Max

func (lq *LinqObj) Max(line string, args ...Object) Object

Max returns the maximum value in a collection of values.

func (*LinqObj) Min

func (lq *LinqObj) Min(line string, args ...Object) Object

Min returns the minimum value in a collection of values.

func (*LinqObj) OrderBy

func (lq *LinqObj) OrderBy(line string, scope *Scope, args ...Object) Object

OrderBy sorts the elements of a collection in ascending order. Elements are sorted according to a key.

func (*LinqObj) OrderByDescending

func (lq *LinqObj) OrderByDescending(line string, scope *Scope, args ...Object) Object

OrderByDescending sorts the elements of a collection in descending order. Elements are sorted according to a key.

func (*LinqObj) Prepend

func (lq *LinqObj) Prepend(line string, args ...Object) Object

func (*LinqObj) Range

func (lq *LinqObj) Range(line string, args ...Object) Object

Range generates a sequence of integral numbers within a specified range.

func (*LinqObj) Repeat

func (lq *LinqObj) Repeat(line string, args ...Object) Object

Repeat generates a sequence that contains one repeated value.

func (*LinqObj) Reverse

func (lq *LinqObj) Reverse(line string, args ...Object) Object

Reverse inverts the order of the elements in a collection.

Unlike OrderBy, this sorting method does not consider the actual values themselves in determining the order. Rather, it just returns the elements in the reverse order from which they are produced by the underlying source.

func (*LinqObj) Select

func (lq *LinqObj) Select(line string, scope *Scope, args ...Object) Object

func (*LinqObj) Select2

func (lq *LinqObj) Select2(line string, scope *Scope, args ...Object) Object

func (*LinqObj) SelectMany

func (lq *LinqObj) SelectMany(line string, scope *Scope, args ...Object) Object

SelectMany projects each element of a collection to a Query, iterates and flattens the resulting collection into one collection.

func (*LinqObj) SelectManyBy

func (lq *LinqObj) SelectManyBy(line string, scope *Scope, args ...Object) Object

SelectManyBy projects each element of a collection to a Query, iterates and flattens the resulting collection into one collection, and invokes a result selector function on each element therein.

func (*LinqObj) SelectManyByIndexed

func (lq *LinqObj) SelectManyByIndexed(line string, scope *Scope, args ...Object) Object

SelectManyByIndexed projects each element of a collection to a Query, iterates and flattens the resulting collection into one collection, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element.

func (*LinqObj) SelectManyIndexed

func (lq *LinqObj) SelectManyIndexed(line string, scope *Scope, args ...Object) Object

SelectManyIndexed projects each element of a collection to a Query, iterates and flattens the resulting collection into one collection.

The first argument to selector represents the zero-based index of that element in the source collection. This can be useful if the elements are in a known order and you want to do something with an element at a particular index, for example. It can also be useful if you want to retrieve the index of one or more elements. The second argument to selector represents the element to process.

func (*LinqObj) SequenceEqual

func (lq *LinqObj) SequenceEqual(line string, args ...Object) Object

SequenceEqual determines whether two collections are equalp.

func (*LinqObj) Single

func (lq *LinqObj) Single(line string, args ...Object) Object

Single returns the only element of a collection, and nil if there is not exactly one element in the collection.

func (*LinqObj) SingleWith

func (lq *LinqObj) SingleWith(line string, scope *Scope, args ...Object) Object

SingleWith returns the only element of a collection that satisfies a specified condition, and nil if more than one such element exists.

func (*LinqObj) Skip

func (lq *LinqObj) Skip(line string, args ...Object) Object

Skip bypasses a specified number of elements in a collection and then returns the remaining elements..

func (*LinqObj) SkipWhile

func (lq *LinqObj) SkipWhile(line string, scope *Scope, args ...Object) Object

SkipWhile bypasses elements in a collection as long as a specified condition is true and then returns the remaining elements.

This method tests each element by using predicate and skips the element if the result is true. After the predicate function returns false for an element, that element and the remaining elements in source are returned and there are no more invocations of predicate.

func (*LinqObj) SkipWhileIndexed

func (lq *LinqObj) SkipWhileIndexed(line string, scope *Scope, args ...Object) Object

SkipWhileIndexed bypasses elements in a collection as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.

This method tests each element by using predicate and skips the element if the result is true. After the predicate function returns false for an element, that element and the remaining elements in source are returned and there are no more invocations of predicate.

func (*LinqObj) Sort

func (lq *LinqObj) Sort(line string, scope *Scope, args ...Object) Object

Sort returns a new query by sorting elements with provided less function in ascending order. The comparer function should return true if the parameter i is less than j. While this method is uglier than chaining OrderBy, OrderByDescending, ThenBy and ThenByDescending methods, it's performance is much better.

func (*LinqObj) SumFloats

func (lq *LinqObj) SumFloats(line string, args ...Object) Object

SumFloats computes the sum of a collection of numeric values.

Method returns zero if collection contains no elements.

func (*LinqObj) SumInts

func (lq *LinqObj) SumInts(line string, args ...Object) Object

SumInts computes the sum of a collection of numeric values.

Method returns zero if collection contains no elements.

func (*LinqObj) SumUInts

func (lq *LinqObj) SumUInts(line string, args ...Object) Object

SumUInts computes the sum of a collection of numeric values.

Method returns zero if collection contains no elements.

func (*LinqObj) Take

func (lq *LinqObj) Take(line string, args ...Object) Object

Take returns a specified number of contiguous elements from the start of a collection.

func (*LinqObj) TakeWhile

func (lq *LinqObj) TakeWhile(line string, scope *Scope, args ...Object) Object

TakeWhile returns elements from a collection as long as a specified condition is true, and then skips the remaining elements.

func (*LinqObj) TakeWhileIndexed

func (lq *LinqObj) TakeWhileIndexed(line string, scope *Scope, args ...Object) Object

TakeWhileIndexed returns elements from a collection as long as a specified condition is true. The element's index is used in the logic of the predicate function. The first argument of predicate represents the zero-based index of the element within collection. The second argument represents the element to test.

func (*LinqObj) ThenBy

func (lq *LinqObj) ThenBy(line string, scope *Scope, args ...Object) Object

ThenBy performs a subsequent ordering of the elements in a collection in ascending order. This method enables you to specify multiple sort criteria by applying any number of ThenBy or ThenByDescending methods.

func (*LinqObj) ThenByDescending

func (lq *LinqObj) ThenByDescending(line string, scope *Scope, args ...Object) Object

ThenByDescending performs a subsequent ordering of the elements in a collection in descending order. This method enables you to specify multiple sort criteria by applying any number of ThenBy or ThenByDescending methods.

func (*LinqObj) ToMap

func (lq *LinqObj) ToMap(line string, scope *Scope, args ...Object) Object

func (*LinqObj) ToOrderedSlice

func (lq *LinqObj) ToOrderedSlice(line string, args ...Object) Object

func (*LinqObj) ToSlice

func (lq *LinqObj) ToSlice(line string, args ...Object) Object

ToSlice iterates over a collection and saves the results in the slice pointed by v. It overwrites the existing slice, starting from index 0.

If the slice pointed by v has sufficient capacity, v will be pointed to a resliced slice. If it does not, a new underlying array will be allocated and v will point to it.

func (*LinqObj) Type

func (lq *LinqObj) Type() ObjectType

func (*LinqObj) Union

func (lq *LinqObj) Union(line string, args ...Object) Object

Union produces the set union of two collections.

This method excludes duplicates from the return set. This is different behavior to the Concat method, which returns all the elements in the input collection including duplicates.

func (*LinqObj) Where

func (lq *LinqObj) Where(line string, scope *Scope, args ...Object) Object

Where filters a collection of values based on a predicate.

func (*LinqObj) Where2

func (lq *LinqObj) Where2(line string, scope *Scope, args ...Object) Object

Where filters a collection of values based on a predicate.

func (*LinqObj) Zip

func (lq *LinqObj) Zip(line string, scope *Scope, args ...Object) Object

Zip applies a specified function to the corresponding elements of two collections, producing a collection of the results.

The method steps through the two input collections, applying function resultSelector to corresponding elements of the two collections. The method returns a collection of the values that are returned by resultSelector. If the input collections do not have the same number of elements, the method combines elements until it reaches the end of one of the collections. For example, if one collection has three elements and the other one has four, the result collection has only three elements.

type ListElemObject

type ListElemObject struct {
	Elem *list.Element
}

List element object

func (*ListElemObject) CallMethod

func (e *ListElemObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ListElemObject) Inspect

func (e *ListElemObject) Inspect() string

func (*ListElemObject) Next

func (e *ListElemObject) Next(line string, args ...Object) Object

func (*ListElemObject) Prev

func (e *ListElemObject) Prev(line string, args ...Object) Object

func (*ListElemObject) Type

func (e *ListElemObject) Type() ObjectType

type ListObject

type ListObject struct {
	List *list.List
}

List object

func (*ListObject) Back

func (l *ListObject) Back(line string, args ...Object) Object

func (*ListObject) CallMethod

func (l *ListObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ListObject) Front

func (l *ListObject) Front(line string, args ...Object) Object

func (*ListObject) Init

func (l *ListObject) Init(line string, args ...Object) Object

func (*ListObject) InsertAfter

func (l *ListObject) InsertAfter(line string, args ...Object) Object

func (*ListObject) InsertBefore

func (l *ListObject) InsertBefore(line string, args ...Object) Object

func (*ListObject) Inspect

func (l *ListObject) Inspect() string

func (*ListObject) Len

func (l *ListObject) Len(line string, args ...Object) Object

func (*ListObject) MoveToBack

func (l *ListObject) MoveToBack(line string, args ...Object) Object

func (*ListObject) MoveToFront

func (l *ListObject) MoveToFront(line string, args ...Object) Object

func (*ListObject) PushBack

func (l *ListObject) PushBack(line string, args ...Object) Object

func (*ListObject) PushBackList

func (l *ListObject) PushBackList(line string, args ...Object) Object

func (*ListObject) PushFront

func (l *ListObject) PushFront(line string, args ...Object) Object

func (*ListObject) PushFrontList

func (l *ListObject) PushFrontList(line string, args ...Object) Object

func (*ListObject) Remove

func (l *ListObject) Remove(line string, args ...Object) Object

func (*ListObject) Type

func (l *ListObject) Type() ObjectType

type LoggerObj

type LoggerObj struct {
	Logger *log.Logger
}

func (*LoggerObj) CallMethod

func (l *LoggerObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*LoggerObj) Fatal

func (l *LoggerObj) Fatal(line string, args ...Object) Object

func (*LoggerObj) Fatalf

func (l *LoggerObj) Fatalf(line string, args ...Object) Object

func (*LoggerObj) Fatalln

func (l *LoggerObj) Fatalln(line string, args ...Object) Object

func (*LoggerObj) Flags

func (l *LoggerObj) Flags(line string, args ...Object) Object

func (*LoggerObj) Inspect

func (l *LoggerObj) Inspect() string

func (*LoggerObj) Output

func (l *LoggerObj) Output(line string, args ...Object) Object

func (*LoggerObj) Panic

func (l *LoggerObj) Panic(line string, args ...Object) Object

func (*LoggerObj) Panicf

func (l *LoggerObj) Panicf(line string, args ...Object) Object

func (*LoggerObj) Panicln

func (l *LoggerObj) Panicln(line string, args ...Object) Object

func (*LoggerObj) Prefix

func (l *LoggerObj) Prefix(line string, args ...Object) Object

func (*LoggerObj) Print

func (l *LoggerObj) Print(line string, args ...Object) Object

func (*LoggerObj) Printf

func (l *LoggerObj) Printf(line string, args ...Object) Object

func (*LoggerObj) Println

func (l *LoggerObj) Println(line string, args ...Object) Object

func (*LoggerObj) SetFlags

func (l *LoggerObj) SetFlags(line string, args ...Object) Object

func (*LoggerObj) SetOutput

func (l *LoggerObj) SetOutput(line string, args ...Object) Object

func (*LoggerObj) SetPrefix

func (l *LoggerObj) SetPrefix(line string, args ...Object) Object

func (*LoggerObj) Type

func (l *LoggerObj) Type() ObjectType

type MatcherFunc

type MatcherFunc func(*http.Request, *RouteMatch) bool

MatcherFunc is the function signature used by custom matchers.

func (MatcherFunc) Match

func (m MatcherFunc) Match(r *http.Request, match *RouteMatch) bool

Match returns the match for a given request.

type Math

type Math struct{}

func (*Math) Abs

func (m *Math) Abs(line string, args ...Object) Object

func (*Math) Acos

func (m *Math) Acos(line string, args ...Object) Object

func (*Math) Acosh

func (m *Math) Acosh(line string, args ...Object) Object

func (*Math) Asin

func (m *Math) Asin(line string, args ...Object) Object

func (*Math) Asinh

func (m *Math) Asinh(line string, args ...Object) Object

func (*Math) Atan

func (m *Math) Atan(line string, args ...Object) Object

func (*Math) Atan2

func (m *Math) Atan2(line string, args ...Object) Object

func (*Math) Atanh

func (m *Math) Atanh(line string, args ...Object) Object

func (*Math) CallMethod

func (m *Math) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Math) Ceil

func (m *Math) Ceil(line string, args ...Object) Object

func (*Math) Cos

func (m *Math) Cos(line string, args ...Object) Object

func (*Math) Cosh

func (m *Math) Cosh(line string, args ...Object) Object

func (*Math) Exp

func (m *Math) Exp(line string, args ...Object) Object

func (*Math) Floor

func (m *Math) Floor(line string, args ...Object) Object

func (*Math) Inf

func (m *Math) Inf(line string, args ...Object) Object

func (*Math) Inspect

func (m *Math) Inspect() string

func (*Math) IsInf

func (m *Math) IsInf(line string, args ...Object) Object

func (*Math) IsNaN

func (m *Math) IsNaN(line string, args ...Object) Object

func (*Math) Max

func (m *Math) Max(line string, args ...Object) Object

func (*Math) Min

func (m *Math) Min(line string, args ...Object) Object

func (*Math) NaN

func (m *Math) NaN(line string, args ...Object) Object

func (*Math) Pow

func (m *Math) Pow(line string, args ...Object) Object

func (*Math) Rand

func (m *Math) Rand(line string, args ...Object) Object

func (*Math) RandSeed

func (m *Math) RandSeed(line string, args ...Object) Object

func (*Math) Sin

func (m *Math) Sin(line string, args ...Object) Object

func (*Math) Sinh

func (m *Math) Sinh(line string, args ...Object) Object

func (*Math) Sqrt

func (m *Math) Sqrt(line string, args ...Object) Object

func (*Math) Tan

func (m *Math) Tan(line string, args ...Object) Object

func (*Math) Tanh

func (m *Math) Tanh(line string, args ...Object) Object

func (*Math) Type

func (m *Math) Type() ObjectType

type MethodInfo

type MethodInfo struct {
	Name     string          //Method name
	Instance *ObjectInstance //instance
	Scope    *Scope          //Method's scope
}

MethodInfo object

func (*MethodInfo) CallMethod

func (m *MethodInfo) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*MethodInfo) GetAnnotation

func (m *MethodInfo) GetAnnotation(line string, args ...Object) Object

func (*MethodInfo) GetAnnotations

func (m *MethodInfo) GetAnnotations(line string, args ...Object) Object

func (*MethodInfo) GetName

func (m *MethodInfo) GetName(line string, args ...Object) Object

func (*MethodInfo) Inspect

func (m *MethodInfo) Inspect() string

func (*MethodInfo) Invoke

func (m *MethodInfo) Invoke(line string, scope *Scope, args ...Object) Object

func (*MethodInfo) Type

func (m *MethodInfo) Type() ObjectType

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

MiddlewareFunc is a function which receives an http.Handler and returns another http.Handler. Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc.

func CORSMethodMiddleware

func CORSMethodMiddleware(r *Router) MiddlewareFunc

CORSMethodMiddleware automatically sets the Access-Control-Allow-Methods response header on requests for routes that have an OPTIONS method matcher to all the method matchers on the route. Routes that do not explicitly handle OPTIONS requests will not be processed by the middleware. See examples for usage.

func (MiddlewareFunc) Middleware

func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler

Middleware allows MiddlewareFunc to implement the middleware interface.

type NetObj

type NetObj struct{}

func (*NetObj) CallMethod

func (n *NetObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*NetObj) Inspect

func (n *NetObj) Inspect() string

func (*NetObj) JoinHostPort

func (n *NetObj) JoinHostPort(line string, args ...Object) Object

func (*NetObj) LookupAddr

func (n *NetObj) LookupAddr(line string, args ...Object) Object

func (*NetObj) LookupHost

func (n *NetObj) LookupHost(line string, args ...Object) Object

func (*NetObj) LookupIP

func (n *NetObj) LookupIP(line string, args ...Object) Object

func (*NetObj) LookupPort

func (n *NetObj) LookupPort(line string, args ...Object) Object

func (*NetObj) SplitHostPort

func (n *NetObj) SplitHostPort(line string, args ...Object) Object

func (*NetObj) Type

func (n *NetObj) Type() ObjectType

type Nil

type Nil struct {
	//sometimes when a function fails, it will return NIL. If this happens, we also need to
	//know the error reason. The error message is stored in `OptionalMsg`
	OptionalMsg string
}

func NewNil

func NewNil(s string) *Nil

return a Nil object with error message 's'

func (*Nil) CallMethod

func (n *Nil) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Nil) Inspect

func (n *Nil) Inspect() string

func (*Nil) MarshalJSON

func (n *Nil) MarshalJSON() ([]byte, error)

Json marshal handling

func (*Nil) Message

func (n *Nil) Message(line string, args ...Object) Object

func (*Nil) Type

func (n *Nil) Type() ObjectType

func (*Nil) UnmarshalJSON

func (n *Nil) UnmarshalJSON(b []byte) error

type Number

type Number interface {
	// contains filtered or unexported methods
}

Whether the Object is a number (UINT, INT, FLOAT)

type Object

type Object interface {
	Type() ObjectType
	Inspect() string
	CallMethod(line string, scope *Scope, method string, args ...Object) Object
}

func Eval

func Eval(node ast.Node, scope *Scope) (val Object)

func GetGlobalObj

func GetGlobalObj(name string) (Object, bool)

func GoValueToObject

func GoValueToObject(obj interface{}) Object

Go language Value to magpie language Object(take care of slice object value)

func NewError

func NewError(line string, t int, args ...interface{}) Object

func NewHTTPObj

func NewHTTPObj() Object

func NewIOUtilObj

func NewIOUtilObj() Object

func NewJsonObj

func NewJsonObj() Object

func NewLoggerObj

func NewLoggerObj() Object

func NewMathObj

func NewMathObj() Object

func NewNetObj

func NewNetObj() Object

func NewOptionalObj

func NewOptionalObj() Object

func NewOsObj

func NewOsObj() Object

func NewRegExpObj

func NewRegExpObj() Object

func NewService

func NewService(addr string) Object

func NewSortObj

func NewSortObj() Object

func NewSqlsObject

func NewSqlsObject() Object

func NewStringsObj

func NewStringsObj() Object

func NewTemplateObj

func NewTemplateObj() Object

func NewTimeObj

func NewTimeObj() Object

type ObjectInstance

type ObjectInstance struct {
	Class *Class
	Scope *Scope
}

func (*ObjectInstance) CallMethod

func (oi *ObjectInstance) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ObjectInstance) GetMethod

func (oi *ObjectInstance) GetMethod(name string) ClassMethod

func (*ObjectInstance) GetModifierLevel

func (oi *ObjectInstance) GetModifierLevel(name string, kind ClassComponentKind) ast.ModifierLevel

func (*ObjectInstance) GetProperty

func (oi *ObjectInstance) GetProperty(name string) *ast.PropertyDeclStmt

func (*ObjectInstance) Inspect

func (oi *ObjectInstance) Inspect() string

func (*ObjectInstance) IsStatic

func (oi *ObjectInstance) IsStatic(val string, kind ClassComponentKind) bool

func (*ObjectInstance) Type

func (oi *ObjectInstance) Type() ObjectType

type ObjectType

type ObjectType string

type Optional

type Optional struct {
	Value Object
}

func (*Optional) CallMethod

func (o *Optional) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Optional) Empty

func (o *Optional) Empty(line string, args ...Object) Object

Returns an empty Optional instance. No value is present for this Optional.

func (*Optional) Filter

func (o *Optional) Filter(line string, scope *Scope, args ...Object) Object

If a value is present, and the value matches the given predicate, returns an Optional describing the value, otherwise returns an empty Optional.

func (*Optional) FlatMap

func (o *Optional) FlatMap(line string, scope *Scope, args ...Object) Object

func (*Optional) Get

func (o *Optional) Get(line string, args ...Object) Object

If a value is present, returns the value, otherwise panic

func (*Optional) IfPresent

func (o *Optional) IfPresent(line string, scope *Scope, args ...Object) Object

If a value is present, performs the given action with the value, otherwise does nothing.

func (*Optional) IfPresentOrElse

func (o *Optional) IfPresentOrElse(line string, scope *Scope, args ...Object) Object

If a value is present, performs the given action with the value, otherwise performs the given empty-based action.

func (*Optional) Inspect

func (o *Optional) Inspect() string

func (*Optional) IsPresent

func (o *Optional) IsPresent(line string, args ...Object) Object

If a value is present, returns true, otherwise false.

func (*Optional) Map

func (o *Optional) Map(line string, scope *Scope, args ...Object) Object

If a value is present, returns an Optional describing (as if by ofNullable) the result of applying the given mapping function to the value, otherwise returns an empty Optional.

If the mapping function returns a nil result then this method returns an empty Optional.

func (*Optional) Of

func (o *Optional) Of(line string, args ...Object) Object

Returns an Optional describing the given no-nil value.

func (*Optional) OfNullable

func (o *Optional) OfNullable(line string, args ...Object) Object

Returns an Optional describing the given value, if non-nil, otherwise returns an empty Optional.

func (*Optional) Or

func (o *Optional) Or(line string, scope *Scope, args ...Object) Object

If a value is present, returns an Optional describing the value, otherwise returns an Optional produced by the supplying function.

func (*Optional) OrElse

func (o *Optional) OrElse(line string, args ...Object) Object

If a value is present, returns the value, otherwise returns other.

func (*Optional) OrElseGet

func (o *Optional) OrElseGet(line string, scope *Scope, args ...Object) Object

If a value is present, returns the value, otherwise returns the result produced by the supplying function.

func (*Optional) OrElseThrow

func (o *Optional) OrElseThrow(line string, args ...Object) Object

If a value is present, returns the value, otherwise throws an exception produced by the exception supplying function.

func (*Optional) Type

func (o *Optional) Type() ObjectType

type OrderedQuery

type OrderedQuery struct {
	Query
	// contains filtered or unexported fields
}

OrderedQuery is the type returned from OrderBy, OrderByDescending ThenBy and ThenByDescending functions.

type Ordering

type Ordering int
const (
	Ascending Ordering = iota
	Descending
	CaseInsensitiveAscending
	CaseInsensitiveDescending
)

type Os

type Os struct{}

func (*Os) Args

func (o *Os) Args(line string, args ...Object) Object

func (*Os) CallMethod

func (o *Os) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Os) Chdir

func (o *Os) Chdir(line string, args ...Object) Object

func (*Os) Chmod

func (o *Os) Chmod(line string, args ...Object) Object

func (*Os) Chown

func (o *Os) Chown(line string, args ...Object) Object

func (*Os) Clearenv

func (o *Os) Clearenv(line string, args ...Object) Object

func (*Os) CopyFile

func (o *Os) CopyFile(line string, args ...Object) Object

func (*Os) Environ

func (o *Os) Environ(line string, args ...Object) Object

func (*Os) Exit

func (o *Os) Exit(line string, args ...Object) Object

func (*Os) Expand

func (o *Os) Expand(scope *Scope, line string, args ...Object) Object

func (*Os) ExpandEnv

func (o *Os) ExpandEnv(line string, args ...Object) Object

func (*Os) Getenv

func (o *Os) Getenv(line string, args ...Object) Object

func (*Os) Getwd

func (o *Os) Getwd(line string, args ...Object) Object

func (*Os) Hostname

func (o *Os) Hostname(line string, args ...Object) Object

func (*Os) Inspect

func (o *Os) Inspect() string

func (*Os) IsExist

func (o *Os) IsExist(line string, args ...Object) Object
func (o *Os) Link(line string, args ...Object) Object

func (*Os) Mkdir

func (o *Os) Mkdir(line string, args ...Object) Object

func (*Os) MkdirAll

func (o *Os) MkdirAll(line string, args ...Object) Object
func (o *Os) Readlink(line string, args ...Object) Object

func (*Os) Remove

func (o *Os) Remove(line string, args ...Object) Object

func (*Os) RemoveAll

func (o *Os) RemoveAll(line string, args ...Object) Object

func (*Os) Rename

func (o *Os) Rename(line string, args ...Object) Object

func (*Os) RunCmd

func (o *Os) RunCmd(line string, args ...Object) Object

func (*Os) Setenv

func (o *Os) Setenv(line string, args ...Object) Object

func (*Os) Stat

func (o *Os) Stat(line string, args ...Object) Object

The result is a hash object: {name: bb.mp, size: 240, mode: 438, isDir: false}

func (*Os) TempDir

func (o *Os) TempDir(line string, args ...Object) Object

func (*Os) Truncate

func (o *Os) Truncate(line string, args ...Object) Object

func (*Os) Type

func (o *Os) Type() ObjectType

func (*Os) Unsetenv

func (o *Os) Unsetenv(line string, args ...Object) Object

type PipeObj

type PipeObj struct {
	Reader *io.PipeReader
	Writer *io.PipeWriter
}

Pipe Object

func (*PipeObj) CallMethod

func (p *PipeObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*PipeObj) Inspect

func (p *PipeObj) Inspect() string

func (*PipeObj) Read

func (p *PipeObj) Read(line string, args ...Object) Object

func (*PipeObj) ReadClose

func (p *PipeObj) ReadClose(line string, args ...Object) Object

func (*PipeObj) Type

func (p *PipeObj) Type() ObjectType

func (*PipeObj) Write

func (p *PipeObj) Write(line string, args ...Object) Object

func (*PipeObj) WriteClose

func (p *PipeObj) WriteClose(line string, args ...Object) Object

type PropertyInfo

type PropertyInfo struct {
	Name     string          //Property name
	Instance *ObjectInstance //instance
	Scope    *Scope          //Property's scope
}

PropertyInfo object

func (*PropertyInfo) CallMethod

func (p *PropertyInfo) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*PropertyInfo) GetAnnotations

func (p *PropertyInfo) GetAnnotations(line string, scope *Scope, args ...Object) Object

func (*PropertyInfo) GetName

func (p *PropertyInfo) GetName(line string, args ...Object) Object

func (*PropertyInfo) Inspect

func (p *PropertyInfo) Inspect() string

func (*PropertyInfo) Type

func (p *PropertyInfo) Type() ObjectType

func (*PropertyInfo) Value

func (p *PropertyInfo) Value(line string, args ...Object) Object

type Query

type Query struct {
	Iterate func() Iterator
}

Query is the type returned from query functions.

type RegEx

type RegEx struct {
	RegExp *regexp.Regexp
	Value  string
}

func (*RegEx) CallMethod

func (re *RegEx) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*RegEx) FindAllString

func (re *RegEx) FindAllString(line string, args ...Object) Object

func (*RegEx) FindAllStringIndex

func (re *RegEx) FindAllStringIndex(line string, args ...Object) Object

func (*RegEx) FindAllStringSubmatch

func (re *RegEx) FindAllStringSubmatch(line string, args ...Object) Object

func (*RegEx) FindAllStringSubmatchIndex

func (re *RegEx) FindAllStringSubmatchIndex(line string, args ...Object) Object

func (*RegEx) FindString

func (re *RegEx) FindString(line string, args ...Object) Object

func (*RegEx) FindStringIndex

func (re *RegEx) FindStringIndex(line string, args ...Object) Object

func (*RegEx) FindStringSubmatch

func (re *RegEx) FindStringSubmatch(line string, args ...Object) Object

func (*RegEx) FindStringSubmatchIndex

func (re *RegEx) FindStringSubmatchIndex(line string, args ...Object) Object

func (*RegEx) Inspect

func (re *RegEx) Inspect() string

func (*RegEx) MarshalJSON

func (re *RegEx) MarshalJSON() ([]byte, error)

MarshalJSON turns regex into string/json

func (*RegEx) Match

func (re *RegEx) Match(line string, args ...Object) Object

func (*RegEx) NumSubexp

func (re *RegEx) NumSubexp(line string, args ...Object) Object

func (*RegEx) Replace

func (re *RegEx) Replace(line string, args ...Object) Object

func (*RegEx) ReplaceAllLiteralString

func (re *RegEx) ReplaceAllLiteralString(line string, args ...Object) Object

func (*RegEx) ReplaceAllStringFunc

func (re *RegEx) ReplaceAllStringFunc(line string, scope *Scope, args ...Object) Object

func (*RegEx) ReplaceFirstString

func (re *RegEx) ReplaceFirstString(line string, args ...Object) Object

func (*RegEx) Split

func (re *RegEx) Split(line string, args ...Object) Object

func (*RegEx) String

func (re *RegEx) String(line string, args ...Object) Object

func (*RegEx) SubexpNames

func (re *RegEx) SubexpNames(line string, args ...Object) Object

func (*RegEx) Type

func (re *RegEx) Type() ObjectType

func (*RegEx) UnmarshalJSON

func (re *RegEx) UnmarshalJSON(b []byte) error

UnmarshalJSON turns a string into proper regex

type RegExpObj

type RegExpObj struct {
	RegExp *regexp.Regexp
}

func (*RegExpObj) CallMethod

func (rex *RegExpObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*RegExpObj) Compile

func (rex *RegExpObj) Compile(line string, args ...Object) Object

func (*RegExpObj) CompilePOSIX

func (rex *RegExpObj) CompilePOSIX(line string, args ...Object) Object

func (*RegExpObj) FindAllString

func (rex *RegExpObj) FindAllString(line string, args ...Object) Object

func (*RegExpObj) FindAllStringIndex

func (rex *RegExpObj) FindAllStringIndex(line string, args ...Object) Object

func (*RegExpObj) FindAllStringSubmatch

func (rex *RegExpObj) FindAllStringSubmatch(line string, args ...Object) Object

func (*RegExpObj) FindAllStringSubmatchIndex

func (rex *RegExpObj) FindAllStringSubmatchIndex(line string, args ...Object) Object

func (*RegExpObj) FindString

func (rex *RegExpObj) FindString(line string, args ...Object) Object

func (*RegExpObj) FindStringIndex

func (rex *RegExpObj) FindStringIndex(line string, args ...Object) Object

func (*RegExpObj) FindStringSubmatch

func (rex *RegExpObj) FindStringSubmatch(line string, args ...Object) Object

func (*RegExpObj) FindStringSubmatchIndex

func (rex *RegExpObj) FindStringSubmatchIndex(line string, args ...Object) Object

func (*RegExpObj) Inspect

func (rex *RegExpObj) Inspect() string

func (*RegExpObj) MatchString

func (rex *RegExpObj) MatchString(line string, args ...Object) Object

func (*RegExpObj) MustCompile

func (rex *RegExpObj) MustCompile(line string, args ...Object) Object

func (*RegExpObj) MustCompilePOSIX

func (rex *RegExpObj) MustCompilePOSIX(line string, args ...Object) Object

func (*RegExpObj) NumSubexp

func (rex *RegExpObj) NumSubexp(line string, args ...Object) Object

func (*RegExpObj) ReplaceAllLiteralString

func (rex *RegExpObj) ReplaceAllLiteralString(line string, args ...Object) Object

func (*RegExpObj) ReplaceAllString

func (rex *RegExpObj) ReplaceAllString(line string, args ...Object) Object

func (*RegExpObj) ReplaceAllStringFunc

func (rex *RegExpObj) ReplaceAllStringFunc(line string, scope *Scope, args ...Object) Object

func (*RegExpObj) Split

func (rex *RegExpObj) Split(line string, args ...Object) Object

func (*RegExpObj) String

func (rex *RegExpObj) String(line string, args ...Object) Object

func (*RegExpObj) SubexpNames

func (rex *RegExpObj) SubexpNames(line string, args ...Object) Object

func (*RegExpObj) Type

func (rex *RegExpObj) Type() ObjectType

type ReturnValue

type ReturnValue struct {
	Value  Object // for old campatibility
	Values []Object
}

func (*ReturnValue) CallMethod

func (rv *ReturnValue) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ReturnValue) Inspect

func (rv *ReturnValue) Inspect() string

func (*ReturnValue) Type

func (rv *ReturnValue) Type() ObjectType

type Route

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

Route stores information to match a request and build URLs.

func CurrentRoute

func CurrentRoute(r *http.Request) *Route

CurrentRoute returns the matched route for the current request, if any. This only works when called inside the handler of the matched route because the matched route is stored in the request context which is cleared after the handler returns, unless the KeepContext option is set on the Router.

func (*Route) BuildOnly

func (r *Route) BuildOnly() *Route

BuildOnly sets the route to never match: it is only used to build URLs.

func (*Route) BuildVarsFunc

func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route

BuildVarsFunc adds a custom function to be used to modify build variables before a route's URL is built.

func (*Route) GetError

func (r *Route) GetError() error

GetError returns an error resulted from building the route, if any.

func (*Route) GetHandler

func (r *Route) GetHandler() http.Handler

GetHandler returns the handler for the route, if any.

func (*Route) GetHostTemplate

func (r *Route) GetHostTemplate() (string, error)

GetHostTemplate returns the template used to build the route match. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not define a host.

func (*Route) GetMethods

func (r *Route) GetMethods() ([]string, error)

GetMethods returns the methods the route matches against This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if route does not have methods.

func (*Route) GetName

func (r *Route) GetName() string

GetName returns the name for the route, if any.

func (*Route) GetPathRegexp

func (r *Route) GetPathRegexp() (string, error)

GetPathRegexp returns the expanded regular expression used to match route path. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not define a path.

func (*Route) GetPathTemplate

func (r *Route) GetPathTemplate() (string, error)

GetPathTemplate returns the template used to build the route match. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not define a path.

func (*Route) GetQueriesRegexp

func (r *Route) GetQueriesRegexp() ([]string, error)

GetQueriesRegexp returns the expanded regular expressions used to match the route queries. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not have queries.

func (*Route) GetQueriesTemplates

func (r *Route) GetQueriesTemplates() ([]string, error)

GetQueriesTemplates returns the templates used to build the query matching. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not define queries.

func (*Route) Handler

func (r *Route) Handler(handler http.Handler) *Route

Handler sets a handler for the route.

func (*Route) HandlerFunc

func (r *Route) HandlerFunc(f func(http.ResponseWriter, *http.Request)) *Route

HandlerFunc sets a handler function for the route.

func (*Route) Headers

func (r *Route) Headers(pairs ...string) *Route

Headers adds a matcher for request header values. It accepts a sequence of key/value pairs to be matched. For example:

r := mux.NewRouter()
r.Headers("Content-Type", "application/json",
          "X-Requested-With", "XMLHttpRequest")

The above route will only match if both request header values match. If the value is an empty string, it will match any value if the key is set.

func (*Route) HeadersRegexp

func (r *Route) HeadersRegexp(pairs ...string) *Route

HeadersRegexp accepts a sequence of key/value pairs, where the value has regex support. For example:

r := mux.NewRouter()
r.HeadersRegexp("Content-Type", "application/(text|json)",
          "X-Requested-With", "XMLHttpRequest")

The above route will only match if both the request header matches both regular expressions. If the value is an empty string, it will match any value if the key is set. Use the start and end of string anchors (^ and $) to match an exact value.

func (*Route) Host

func (r *Route) Host(tpl string) *Route

Host adds a matcher for the URL host. It accepts a template with zero or more URL variables enclosed by {}. Variables can define an optional regexp pattern to be matched:

- {name} matches anything until the next dot.

- {name:pattern} matches the given regexp pattern.

For example:

r := mux.NewRouter()
r.Host("www.example.com")
r.Host("{subdomain}.domain.com")
r.Host("{subdomain:[a-z]+}.domain.com")

Variable names must be unique in a given route. They can be retrieved calling mux.Vars(request).

func (*Route) Match

func (r *Route) Match(req *http.Request, match *RouteMatch) bool

Match matches the route against the request.

func (*Route) MatcherFunc

func (r *Route) MatcherFunc(f MatcherFunc) *Route

MatcherFunc adds a custom function to be used as request matcher.

func (*Route) Methods

func (r *Route) Methods(methods ...string) *Route

Methods adds a matcher for HTTP methods. It accepts a sequence of one or more methods to be matched, e.g.: "GET", "POST", "PUT".

func (*Route) Name

func (r *Route) Name(name string) *Route

Name sets the name for the route, used to build URLs. It is an error to call Name more than once on a route.

func (*Route) Path

func (r *Route) Path(tpl string) *Route

Path adds a matcher for the URL path. It accepts a template with zero or more URL variables enclosed by {}. The template must start with a "/". Variables can define an optional regexp pattern to be matched:

- {name} matches anything until the next slash.

- {name:pattern} matches the given regexp pattern.

For example:

r := mux.NewRouter()
r.Path("/products/").Handler(ProductsHandler)
r.Path("/products/{key}").Handler(ProductsHandler)
r.Path("/articles/{category}/{id:[0-9]+}").
  Handler(ArticleHandler)

Variable names must be unique in a given route. They can be retrieved calling mux.Vars(request).

func (*Route) PathPrefix

func (r *Route) PathPrefix(tpl string) *Route

PathPrefix adds a matcher for the URL path prefix. This matches if the given template is a prefix of the full URL path. See Route.Path() for details on the tpl argument.

Note that it does not treat slashes specially ("/foobar/" will be matched by the prefix "/foo") so you may want to use a trailing slash here.

Also note that the setting of Router.StrictSlash() has no effect on routes with a PathPrefix matcher.

func (*Route) Queries

func (r *Route) Queries(pairs ...string) *Route

Queries adds a matcher for URL query values. It accepts a sequence of key/value pairs. Values may define variables. For example:

r := mux.NewRouter()
r.Queries("foo", "bar", "id", "{id:[0-9]+}")

The above route will only match if the URL contains the defined queries values, e.g.: ?foo=bar&id=42.

If the value is an empty string, it will match any value if the key is set.

Variables can define an optional regexp pattern to be matched:

- {name} matches anything until the next slash.

- {name:pattern} matches the given regexp pattern.

func (*Route) Schemes

func (r *Route) Schemes(schemes ...string) *Route

Schemes adds a matcher for URL schemes. It accepts a sequence of schemes to be matched, e.g.: "http", "https". If the request's URL has a scheme set, it will be matched against. Generally, the URL scheme will only be set if a previous handler set it, such as the ProxyHeaders handler from gorilla/handlers. If unset, the scheme will be determined based on the request's TLS termination state. The first argument to Schemes will be used when constructing a route URL.

func (*Route) SkipClean

func (r *Route) SkipClean() bool

SkipClean reports whether path cleaning is enabled for this route via Router.SkipClean.

func (*Route) Subrouter

func (r *Route) Subrouter() *Router

Subrouter creates a subrouter for the route.

It will test the inner routes only if the parent route matched. For example:

r := mux.NewRouter()
s := r.Host("www.example.com").Subrouter()
s.HandleFunc("/products/", ProductsHandler)
s.HandleFunc("/products/{key}", ProductHandler)
s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)

Here, the routes registered in the subrouter won't be tested if the host doesn't match.

func (*Route) URL

func (r *Route) URL(pairs ...string) (*url.URL, error)

URL builds a URL for the route.

It accepts a sequence of key/value pairs for the route variables. For example, given this route:

r := mux.NewRouter()
r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
  Name("article")

...a URL for it can be built using:

url, err := r.Get("article").URL("category", "technology", "id", "42")

...which will return an url.URL with the following path:

"/articles/technology/42"

This also works for host variables:

r := mux.NewRouter()
r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
  Host("{subdomain}.domain.com").
  Name("article")

// url.String() will be "http://news.domain.com/articles/technology/42"
url, err := r.Get("article").URL("subdomain", "news",
                                 "category", "technology",
                                 "id", "42")

The scheme of the resulting url will be the first argument that was passed to Schemes:

// url.String() will be "https://example.com"
r := mux.NewRouter()
url, err := r.Host("example.com")
             .Schemes("https", "http").URL()

All variables defined in the route are required, and their values must conform to the corresponding patterns.

func (*Route) URLHost

func (r *Route) URLHost(pairs ...string) (*url.URL, error)

URLHost builds the host part of the URL for a route. See Route.URL().

The route must have a host defined.

func (*Route) URLPath

func (r *Route) URLPath(pairs ...string) (*url.URL, error)

URLPath builds the path part of the URL for a route. See Route.URL().

The route must have a path defined.

type RouteMatch

type RouteMatch struct {
	Route   *Route
	Handler http.Handler
	Vars    map[string]string

	// MatchErr is set to appropriate matching error
	// It is set to ErrMethodMismatch if there is a mismatch in
	// the request method and route method
	MatchErr error
}

RouteMatch stores information about a matched route.

type Router

type Router struct {
	// Configurable Handler to be used when no route matches.
	NotFoundHandler http.Handler

	// Configurable Handler to be used when the request method does not match the route.
	MethodNotAllowedHandler http.Handler

	// If true, do not clear the request context after handling the request.
	//
	// Deprecated: No effect, since the context is stored on the request itself.
	KeepContext bool
	// contains filtered or unexported fields
}

Router registers routes to be matched and dispatches a handler.

It implements the http.Handler interface, so it can be registered to serve requests:

var router = mux.NewRouter()

func main() {
    http.Handle("/", router)
}

Or, for Google App Engine, register it in a init() function:

func init() {
    http.Handle("/", router)
}

This will send all incoming requests to the router.

func NewRouter

func NewRouter() *Router

NewRouter returns a new router instance.

func (*Router) BuildVarsFunc

func (r *Router) BuildVarsFunc(f BuildVarsFunc) *Route

BuildVarsFunc registers a new route with a custom function for modifying route variables before building a URL.

func (*Router) Get

func (r *Router) Get(name string) *Route

Get returns a route registered with the given name.

func (*Router) GetRoute

func (r *Router) GetRoute(name string) *Route

GetRoute returns a route registered with the given name. This method was renamed to Get() and remains here for backwards compatibility.

func (*Router) Handle

func (r *Router) Handle(path string, handler http.Handler) *Route

Handle registers a new route with a matcher for the URL path. See Route.Path() and Route.Handler().

func (*Router) HandleFunc

func (r *Router) HandleFunc(path string, f func(http.ResponseWriter,
	*http.Request)) *Route

HandleFunc registers a new route with a matcher for the URL path. See Route.Path() and Route.HandlerFunc().

func (*Router) Headers

func (r *Router) Headers(pairs ...string) *Route

Headers registers a new route with a matcher for request header values. See Route.Headers().

func (*Router) Host

func (r *Router) Host(tpl string) *Route

Host registers a new route with a matcher for the URL host. See Route.Host().

func (*Router) Match

func (r *Router) Match(req *http.Request, match *RouteMatch) bool

Match attempts to match the given request against the router's registered routes.

If the request matches a route of this router or one of its subrouters the Route, Handler, and Vars fields of the the match argument are filled and this function returns true.

If the request does not match any of this router's or its subrouters' routes then this function returns false. If available, a reason for the match failure will be filled in the match argument's MatchErr field. If the match failure type (eg: not found) has a registered handler, the handler is assigned to the Handler field of the match argument.

func (*Router) MatcherFunc

func (r *Router) MatcherFunc(f MatcherFunc) *Route

MatcherFunc registers a new route with a custom matcher function. See Route.MatcherFunc().

func (*Router) Methods

func (r *Router) Methods(methods ...string) *Route

Methods registers a new route with a matcher for HTTP methods. See Route.Methods().

func (*Router) Name

func (r *Router) Name(name string) *Route

Name registers a new route with a name. See Route.Name().

func (*Router) NewRoute

func (r *Router) NewRoute() *Route

NewRoute registers an empty route.

func (*Router) Path

func (r *Router) Path(tpl string) *Route

Path registers a new route with a matcher for the URL path. See Route.Path().

func (*Router) PathPrefix

func (r *Router) PathPrefix(tpl string) *Route

PathPrefix registers a new route with a matcher for the URL path prefix. See Route.PathPrefix().

func (*Router) Queries

func (r *Router) Queries(pairs ...string) *Route

Queries registers a new route with a matcher for URL query values. See Route.Queries().

func (*Router) Schemes

func (r *Router) Schemes(schemes ...string) *Route

Schemes registers a new route with a matcher for URL schemes. See Route.Schemes().

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP dispatches the handler registered in the matched route.

When there is a match, the route variables can be retrieved calling mux.Vars(request).

func (*Router) SkipClean

func (r *Router) SkipClean(value bool) *Router

SkipClean defines the path cleaning behaviour for new routes. The initial value is false. Users should be careful about which routes are not cleaned

When true, if the route path is "/path//to", it will remain with the double slash. This is helpful if you have a route like: /fetch/http://xkcd.com/534/

When false, the path will be cleaned, so /fetch/http://xkcd.com/534/ will become /fetch/http/xkcd.com/534

func (*Router) StrictSlash

func (r *Router) StrictSlash(value bool) *Router

StrictSlash defines the trailing slash behavior for new routes. The initial value is false.

When true, if the route path is "/path/", accessing "/path" will perform a redirect to the former and vice versa. In other words, your application will always see the path as specified in the route.

When false, if the route path is "/path", accessing "/path/" will not match this route and vice versa.

The re-direct is a HTTP 301 (Moved Permanently). Note that when this is set for routes with a non-idempotent method (e.g. POST, PUT), the subsequent re-directed request will be made as a GET by most clients. Use middleware or client settings to modify this behaviour as needed.

Special case: when a route sets a path prefix using the PathPrefix() method, strict slash is ignored for that route because the redirect behavior can't be determined from a prefix alone. However, any subrouters created from that route inherit the original StrictSlash setting.

func (*Router) Use

func (r *Router) Use(mwf ...MiddlewareFunc)

Use appends a MiddlewareFunc to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.

func (*Router) UseEncodedPath

func (r *Router) UseEncodedPath() *Router

UseEncodedPath tells the router to match the encoded original path to the routes. For eg. "/path/foo%2Fbar/to" will match the path "/path/{var}/to".

If not called, the router will match the unencoded path to the routes. For eg. "/path/foo%2Fbar/to" will match the path "/path/foo/bar/to"

func (*Router) Walk

func (r *Router) Walk(walkFn WalkFunc) error

Walk walks the router and all its sub-routers, calling walkFn for each route in the tree. The routes are walked in the order they were added. Sub-routers are explored depth-first.

type Scope

type Scope struct {
	Writer    io.Writer
	CallStack *CallStack

	//We need to use `Mutex`, because we added 'spawn'(multithread).
	//if not,when running `spawn`, there will be lot of errors, even core dump.
	//The reason is golang's map is not thread safe
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewScope

func NewScope(p *Scope, w io.Writer) *Scope

func (*Scope) CallerFrame

func (s *Scope) CallerFrame() *CallFrame

CallerFrame return caller's CallFrame

func (*Scope) CurrentFrame

func (s *Scope) CurrentFrame() *CallFrame

func (*Scope) DebugPrint

func (s *Scope) DebugPrint(indent string)

func (*Scope) Get

func (s *Scope) Get(name string) (Object, bool)

func (*Scope) GetKeys

func (s *Scope) GetKeys() []string

Get all the keys of the scope.

func (*Scope) IsReadOnly

func (s *Scope) IsReadOnly(name string) bool

func (*Scope) Reset

func (s *Scope) Reset(name string, val Object) (Object, bool)

func (*Scope) Set

func (s *Scope) Set(name string, val Object) Object

func (*Scope) SetConst

func (s *Scope) SetConst(name string, val Object) Object

type ServiceObj

type ServiceObj struct {
	Addr   string
	Router *Router
	Route  *Route
}

func (*ServiceObj) CallMethod

func (s *ServiceObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*ServiceObj) HandleFunc

func (s *ServiceObj) HandleFunc(line string, scope *Scope, args ...Object) Object

func (*ServiceObj) Headers

func (s *ServiceObj) Headers(line string, args ...Object) Object

func (*ServiceObj) Host

func (s *ServiceObj) Host(line string, args ...Object) Object

func (*ServiceObj) Inspect

func (s *ServiceObj) Inspect() string

func (*ServiceObj) Methods

func (s *ServiceObj) Methods(line string, args ...Object) Object

func (*ServiceObj) Queries

func (s *ServiceObj) Queries(line string, args ...Object) Object

func (*ServiceObj) Run

func (s *ServiceObj) Run(line string, args ...Object) Object

func (*ServiceObj) Schemes

func (s *ServiceObj) Schemes(line string, args ...Object) Object

func (*ServiceObj) Type

func (s *ServiceObj) Type() ObjectType

type SortObj

type SortObj struct{}

func (*SortObj) CallMethod

func (s *SortObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SortObj) FloatsAreSorted

func (s *SortObj) FloatsAreSorted(line string, args ...Object) Object

func (*SortObj) Inspect

func (s *SortObj) Inspect() string

func (*SortObj) IntsAreSorted

func (s *SortObj) IntsAreSorted(line string, args ...Object) Object

func (*SortObj) SortFloats

func (s *SortObj) SortFloats(line string, args ...Object) Object

func (*SortObj) SortInts

func (s *SortObj) SortInts(line string, args ...Object) Object

func (*SortObj) SortStrings

func (s *SortObj) SortStrings(line string, args ...Object) Object

func (*SortObj) SortUInts

func (s *SortObj) SortUInts(line string, args ...Object) Object

func (*SortObj) StringsAreSorted

func (s *SortObj) StringsAreSorted(line string, args ...Object) Object

func (*SortObj) Type

func (s *SortObj) Type() ObjectType

func (*SortObj) UIntsAreSorted

func (s *SortObj) UIntsAreSorted(line string, args ...Object) Object

type SqlObject

type SqlObject struct {
	Db   *sql.DB
	Name string
}

***************************************************************

SQL Object

***************************************************************

func (*SqlObject) Begin

func (s *SqlObject) Begin(line string, args ...Object) Object

func (*SqlObject) CallMethod

func (s *SqlObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SqlObject) Close

func (s *SqlObject) Close(line string, args ...Object) Object

func (*SqlObject) Exec

func (s *SqlObject) Exec(line string, args ...Object) Object

func (*SqlObject) Inspect

func (s *SqlObject) Inspect() string

func (*SqlObject) Ping

func (s *SqlObject) Ping(line string, args ...Object) Object

Return the remote address

func (*SqlObject) Prepare

func (s *SqlObject) Prepare(line string, args ...Object) Object

func (*SqlObject) Query

func (s *SqlObject) Query(line string, args ...Object) Object

func (*SqlObject) QueryRow

func (s *SqlObject) QueryRow(line string, args ...Object) Object

func (*SqlObject) SetMaxIdleConns

func (s *SqlObject) SetMaxIdleConns(line string, args ...Object) Object

func (*SqlObject) SetMaxOpenConns

func (s *SqlObject) SetMaxOpenConns(line string, args ...Object) Object

func (*SqlObject) Type

func (s *SqlObject) Type() ObjectType

type SqlsObject

type SqlsObject struct {
}

This object's purpose is only for 5 predefined null constants

func (*SqlsObject) CallMethod

func (s *SqlsObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SqlsObject) Inspect

func (s *SqlsObject) Inspect() string

func (*SqlsObject) Type

func (s *SqlsObject) Type() ObjectType

type String

type String struct {
	String string
	Valid  bool
}

func NewString

func NewString(s string) *String

Returns a valid String Object, that is Valid=true

func (*String) Atoi

func (s *String) Atoi(line string, args ...Object) Object

func (*String) CallMethod

func (s *String) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*String) Chomp

func (s *String) Chomp(line string, args ...Object) Object

func (*String) Compare

func (s *String) Compare(line string, args ...Object) Object

func (*String) Contains

func (s *String) Contains(line string, args ...Object) Object

func (*String) ContainsAny

func (s *String) ContainsAny(line string, args ...Object) Object

func (*String) Count

func (s *String) Count(line string, args ...Object) Object

func (*String) Fields

func (s *String) Fields(line string, args ...Object) Object

func (*String) Find

func (s *String) Find(line string, args ...Object) Object

func (*String) HasPrefix

func (s *String) HasPrefix(line string, args ...Object) Object

func (*String) HasSuffix

func (s *String) HasSuffix(line string, args ...Object) Object

func (*String) Hash

func (s *String) Hash(line string, args ...Object) Object

code stolen from https://github.com/AlasdairF/Hash/blob/master/hash.go

func (*String) HashKey

func (s *String) HashKey() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) IsEmpty

func (s *String) IsEmpty(line string, args ...Object) Object

func (*String) IsValid

func (s *String) IsValid(line string, args ...Object) Object

func (*String) Itoa

func (s *String) Itoa(line string, args ...Object) Object

func (*String) LastIndex

func (s *String) LastIndex(line string, args ...Object) Object

func (*String) Len

func (s *String) Len(line string, args ...Object) Object

func (*String) Lower

func (s *String) Lower(line string, args ...Object) Object

func (*String) MarshalJSON

func (s *String) MarshalJSON() ([]byte, error)

func (*String) ParseBool

func (s *String) ParseBool(line string, args ...Object) Object

func (*String) ParseFloat

func (s *String) ParseFloat(line string, args ...Object) Object

func (*String) ParseInt

func (s *String) ParseInt(line string, args ...Object) Object

If you want to check if the parse is successful, you could do this:

v = "abcd".parseInt(10)
if !v.valid() {
    println("abcd is not an int")
}

This also applies to parseFloat() and parseBool()

func (*String) ParseUInt

func (s *String) ParseUInt(line string, args ...Object) Object

func (*String) Repeat

func (s *String) Repeat(line string, args ...Object) Object

func (*String) Replace

func (s *String) Replace(line string, args ...Object) Object

func (*String) Reverse

func (s *String) Reverse(line string, args ...Object) Object

func (*String) Scan

func (s *String) Scan(value interface{}) error

func (*String) Set

func (s *String) Set(line string, args ...Object) Object

func (*String) SetValid

func (s *String) SetValid(line string, args ...Object) Object

func (*String) Split

func (s *String) Split(line string, args ...Object) Object

func (*String) SubStr

func (s *String) SubStr(line string, args ...Object) Object

func (*String) Title

func (s *String) Title(line string, args ...Object) Object

func (*String) Trim

func (s *String) Trim(line string, args ...Object) Object

func (*String) TrimLeft

func (s *String) TrimLeft(line string, args ...Object) Object

func (*String) TrimPrefix

func (s *String) TrimPrefix(line string, args ...Object) Object

func (*String) TrimRight

func (s *String) TrimRight(line string, args ...Object) Object

func (*String) TrimSuffix

func (s *String) TrimSuffix(line string, args ...Object) Object

func (*String) Type

func (s *String) Type() ObjectType

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(b []byte) error

func (*String) Upper

func (s *String) Upper(line string, args ...Object) Object

func (String) Value

func (s String) Value() (driver.Value, error)

func (*String) Write

func (s *String) Write(line string, scope *Scope, args ...Object) Object

func (*String) WriteLine

func (s *String) WriteLine(line string, scope *Scope, args ...Object) Object

type StringSlice

type StringSlice struct {
	StrArr    []string
	SortOrder Ordering
}

StringSlice attaches the methods of Interface to []string, sorting in ascending/descending order.

func (StringSlice) Len

func (p StringSlice) Len() int

func (StringSlice) Less

func (p StringSlice) Less(i, j int) bool

func (StringSlice) Sort

func (p StringSlice) Sort()

Sort is a convenience method.

func (StringSlice) Swap

func (p StringSlice) Swap(i, j int)

type StringsObj

type StringsObj struct{}

func (*StringsObj) Atoi

func (s *StringsObj) Atoi(line string, args ...Object) Object

func (*StringsObj) CallMethod

func (s *StringsObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*StringsObj) Chomp

func (s *StringsObj) Chomp(line string, args ...Object) Object

func (*StringsObj) Compare

func (s *StringsObj) Compare(line string, args ...Object) Object

func (*StringsObj) Contains

func (s *StringsObj) Contains(line string, args ...Object) Object

func (*StringsObj) ContainsAny

func (s *StringsObj) ContainsAny(line string, args ...Object) Object

func (*StringsObj) Count

func (s *StringsObj) Count(line string, args ...Object) Object

func (*StringsObj) Fields

func (s *StringsObj) Fields(line string, args ...Object) Object

func (*StringsObj) Find

func (s *StringsObj) Find(line string, args ...Object) Object

func (*StringsObj) HasPrefix

func (s *StringsObj) HasPrefix(line string, args ...Object) Object

func (*StringsObj) HasSuffix

func (s *StringsObj) HasSuffix(line string, args ...Object) Object

func (*StringsObj) Hash

func (s *StringsObj) Hash(line string, args ...Object) Object

code stolen from https://github.com/AlasdairF/Hash/blob/master/hash.go

func (*StringsObj) Inspect

func (s *StringsObj) Inspect() string

func (*StringsObj) IsEmpty

func (s *StringsObj) IsEmpty(line string, args ...Object) Object

func (*StringsObj) Itoa

func (s *StringsObj) Itoa(line string, args ...Object) Object

func (*StringsObj) Join

func (s *StringsObj) Join(line string, args ...Object) Object

join(arr) or join(arr, sep)

func (*StringsObj) LastIndex

func (s *StringsObj) LastIndex(line string, args ...Object) Object

func (*StringsObj) Len

func (s *StringsObj) Len(line string, args ...Object) Object

func (*StringsObj) Lower

func (s *StringsObj) Lower(line string, args ...Object) Object

func (*StringsObj) ParseBool

func (s *StringsObj) ParseBool(line string, args ...Object) Object

func (*StringsObj) ParseFloat

func (s *StringsObj) ParseFloat(line string, args ...Object) Object

func (*StringsObj) ParseInt

func (s *StringsObj) ParseInt(line string, args ...Object) Object

If you want to check if the parse is successful, you could do this:

v = strings.parseInt("abc", 10)
if !v.valid() {
    println("abcd is not an int")
}

This also applies to parseFloat() and parseBool()

func (*StringsObj) ParseUInt

func (s *StringsObj) ParseUInt(line string, args ...Object) Object

func (*StringsObj) Repeat

func (s *StringsObj) Repeat(line string, args ...Object) Object

func (*StringsObj) Replace

func (s *StringsObj) Replace(line string, args ...Object) Object

func (*StringsObj) Reverse

func (s *StringsObj) Reverse(line string, args ...Object) Object

func (*StringsObj) Split

func (s *StringsObj) Split(line string, args ...Object) Object

func (*StringsObj) SubStr

func (s *StringsObj) SubStr(line string, args ...Object) Object

func (*StringsObj) Title

func (s *StringsObj) Title(line string, args ...Object) Object

func (*StringsObj) Trim

func (s *StringsObj) Trim(line string, args ...Object) Object

func (*StringsObj) TrimLeft

func (s *StringsObj) TrimLeft(line string, args ...Object) Object

func (*StringsObj) TrimPrefix

func (s *StringsObj) TrimPrefix(line string, args ...Object) Object

func (*StringsObj) TrimRight

func (s *StringsObj) TrimRight(line string, args ...Object) Object

func (*StringsObj) TrimSuffix

func (s *StringsObj) TrimSuffix(line string, args ...Object) Object

func (*StringsObj) Type

func (s *StringsObj) Type() ObjectType

func (*StringsObj) Upper

func (s *StringsObj) Upper(line string, args ...Object) Object

func (*StringsObj) Write

func (s *StringsObj) Write(line string, scope *Scope, args ...Object) Object

func (*StringsObj) WriteLine

func (s *StringsObj) WriteLine(line string, scope *Scope, args ...Object) Object

type Struct

type Struct struct {
	Scope *Scope
	// contains filtered or unexported fields
}

func (*Struct) CallMethod

func (s *Struct) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Struct) Inspect

func (s *Struct) Inspect() string

func (*Struct) Type

func (s *Struct) Type() ObjectType

type SyncCondObj

type SyncCondObj struct {
	Cond *sync.Cond
}

Condition Object

func (*SyncCondObj) Broadcast

func (c *SyncCondObj) Broadcast(line string, args ...Object) Object

func (*SyncCondObj) CallMethod

func (c *SyncCondObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SyncCondObj) Inspect

func (c *SyncCondObj) Inspect() string

func (*SyncCondObj) Signal

func (c *SyncCondObj) Signal(line string, args ...Object) Object

func (*SyncCondObj) Type

func (c *SyncCondObj) Type() ObjectType

func (*SyncCondObj) Wait

func (c *SyncCondObj) Wait(line string, args ...Object) Object

type SyncMutexObj

type SyncMutexObj struct {
	Mutex *sync.Mutex
}

Mutex Object

func (*SyncMutexObj) CallMethod

func (m *SyncMutexObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SyncMutexObj) Inspect

func (m *SyncMutexObj) Inspect() string

func (*SyncMutexObj) Lock

func (m *SyncMutexObj) Lock(line string, args ...Object) Object

func (*SyncMutexObj) Type

func (m *SyncMutexObj) Type() ObjectType

func (*SyncMutexObj) Unlock

func (m *SyncMutexObj) Unlock(line string, args ...Object) Object

type SyncOnceObj

type SyncOnceObj struct {
	Once *sync.Once
}

Once Object

func (*SyncOnceObj) CallMethod

func (o *SyncOnceObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SyncOnceObj) Do

func (o *SyncOnceObj) Do(line string, scope *Scope, args ...Object) Object

func (*SyncOnceObj) Inspect

func (o *SyncOnceObj) Inspect() string

func (*SyncOnceObj) Type

func (o *SyncOnceObj) Type() ObjectType

type SyncRWMutexObj

type SyncRWMutexObj struct {
	RWMutex *sync.RWMutex
}

RWMutex Object

func (*SyncRWMutexObj) CallMethod

func (rwm *SyncRWMutexObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SyncRWMutexObj) Inspect

func (rwm *SyncRWMutexObj) Inspect() string

func (*SyncRWMutexObj) Lock

func (rwm *SyncRWMutexObj) Lock(line string, args ...Object) Object

func (*SyncRWMutexObj) RLock

func (rwm *SyncRWMutexObj) RLock(line string, args ...Object) Object

func (*SyncRWMutexObj) RUnlock

func (rwm *SyncRWMutexObj) RUnlock(line string, args ...Object) Object

func (*SyncRWMutexObj) Type

func (rwm *SyncRWMutexObj) Type() ObjectType

func (*SyncRWMutexObj) Unlock

func (rwm *SyncRWMutexObj) Unlock(line string, args ...Object) Object

type SyncWaitGroupObj

type SyncWaitGroupObj struct {
	WaitGroup *sync.WaitGroup
}

WaitGroup Oject

func (*SyncWaitGroupObj) Add

func (wg *SyncWaitGroupObj) Add(line string, args ...Object) Object

func (*SyncWaitGroupObj) CallMethod

func (wg *SyncWaitGroupObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*SyncWaitGroupObj) Done

func (wg *SyncWaitGroupObj) Done(line string, args ...Object) Object

func (*SyncWaitGroupObj) Inspect

func (wg *SyncWaitGroupObj) Inspect() string

func (*SyncWaitGroupObj) Type

func (wg *SyncWaitGroupObj) Type() ObjectType

func (*SyncWaitGroupObj) Wait

func (wg *SyncWaitGroupObj) Wait(line string, args ...Object) Object

type TCPListenerObject

type TCPListenerObject struct {
	Listener *net.TCPListener
	Address  string
}

TCP Listener object

func (*TCPListenerObject) AcceptTCP

func (l *TCPListenerObject) AcceptTCP(line string, args ...Object) Object

func (*TCPListenerObject) Addr

func (l *TCPListenerObject) Addr(line string, args ...Object) Object

func (*TCPListenerObject) CallMethod

func (l *TCPListenerObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*TCPListenerObject) Close

func (l *TCPListenerObject) Close(line string, args ...Object) Object

func (*TCPListenerObject) Inspect

func (l *TCPListenerObject) Inspect() string

func (*TCPListenerObject) SetDeadline

func (l *TCPListenerObject) SetDeadline(line string, args ...Object) Object

func (*TCPListenerObject) Type

func (l *TCPListenerObject) Type() ObjectType

type TcpConnObject

type TcpConnObject struct {
	Conn    *net.TCPConn
	Address string
}

TCP connection object

func (*TcpConnObject) Addr

func (t *TcpConnObject) Addr(line string, args ...Object) Object

Return the remote address

func (*TcpConnObject) CallMethod

func (t *TcpConnObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*TcpConnObject) Close

func (t *TcpConnObject) Close(line string, args ...Object) Object

func (*TcpConnObject) CloseRead

func (t *TcpConnObject) CloseRead(line string, args ...Object) Object

func (*TcpConnObject) CloseWrite

func (t *TcpConnObject) CloseWrite(line string, args ...Object) Object

func (*TcpConnObject) Inspect

func (t *TcpConnObject) Inspect() string

func (*TcpConnObject) Read

func (t *TcpConnObject) Read(line string, args ...Object) Object

func (*TcpConnObject) Read2

func (t *TcpConnObject) Read2(line string, args ...Object) Object

func (*TcpConnObject) SetDeadline

func (t *TcpConnObject) SetDeadline(line string, args ...Object) Object

func (*TcpConnObject) SetLinger

func (t *TcpConnObject) SetLinger(line string, args ...Object) Object

func (*TcpConnObject) SetNoDelay

func (t *TcpConnObject) SetNoDelay(line string, args ...Object) Object

func (*TcpConnObject) SetReadBuffer

func (t *TcpConnObject) SetReadBuffer(line string, args ...Object) Object

func (*TcpConnObject) SetReadDeadline

func (t *TcpConnObject) SetReadDeadline(line string, args ...Object) Object

func (*TcpConnObject) SetWriteBuffer

func (t *TcpConnObject) SetWriteBuffer(line string, args ...Object) Object

func (*TcpConnObject) SetWriteDeadline

func (t *TcpConnObject) SetWriteDeadline(line string, args ...Object) Object

func (*TcpConnObject) Type

func (t *TcpConnObject) Type() ObjectType

func (*TcpConnObject) Write

func (t *TcpConnObject) Write(line string, args ...Object) Object

type TemplateObj

type TemplateObj struct {
	TmplType     int64 //template type
	TextTemplate *text.Template
	HTMLTemplate *html.Template
}

func (*TemplateObj) CallMethod

func (t *TemplateObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*TemplateObj) Clone

func (t *TemplateObj) Clone(line string, args ...Object) Object

func (*TemplateObj) DefinedTemplates

func (t *TemplateObj) DefinedTemplates(line string, args ...Object) Object

func (*TemplateObj) Delims

func (t *TemplateObj) Delims(line string, args ...Object) Object

func (*TemplateObj) Execute

func (t *TemplateObj) Execute(line string, args ...Object) Object

func (*TemplateObj) ExecuteTemplate

func (t *TemplateObj) ExecuteTemplate(line string, args ...Object) Object

Note :ExecuteTemplate is similar to Execute function, should extract a common private function.

func (*TemplateObj) Funcs

func (t *TemplateObj) Funcs(line string, scope *Scope, args ...Object) Object

func (*TemplateObj) HTMLEscape

func (t *TemplateObj) HTMLEscape(line string, args ...Object) Object

func (*TemplateObj) HTMLEscapeString

func (t *TemplateObj) HTMLEscapeString(line string, args ...Object) Object

func (*TemplateObj) HTMLEscaper

func (t *TemplateObj) HTMLEscaper(line string, args ...Object) Object

func (*TemplateObj) Inspect

func (t *TemplateObj) Inspect() string

func (*TemplateObj) JSEscape

func (t *TemplateObj) JSEscape(line string, args ...Object) Object

func (*TemplateObj) JSEscapeString

func (t *TemplateObj) JSEscapeString(line string, args ...Object) Object

func (*TemplateObj) JSEscaper

func (t *TemplateObj) JSEscaper(line string, args ...Object) Object

func (*TemplateObj) Lookup

func (t *TemplateObj) Lookup(line string, args ...Object) Object

func (*TemplateObj) Name

func (t *TemplateObj) Name(line string, args ...Object) Object

func (*TemplateObj) New

func (t *TemplateObj) New(line string, args ...Object) Object

func (*TemplateObj) NewHtml

func (t *TemplateObj) NewHtml(line string, args ...Object) Object

func (*TemplateObj) NewText

func (t *TemplateObj) NewText(line string, args ...Object) Object

func (*TemplateObj) Option

func (t *TemplateObj) Option(line string, args ...Object) Object

func (*TemplateObj) Parse

func (t *TemplateObj) Parse(line string, args ...Object) Object

func (*TemplateObj) ParseFiles

func (t *TemplateObj) ParseFiles(line string, args ...Object) Object

func (*TemplateObj) ParseGlob

func (t *TemplateObj) ParseGlob(line string, args ...Object) Object

func (*TemplateObj) ParseHtmlFiles

func (t *TemplateObj) ParseHtmlFiles(line string, args ...Object) Object

func (*TemplateObj) ParseHtmlGlob

func (t *TemplateObj) ParseHtmlGlob(line string, args ...Object) Object

func (*TemplateObj) ParseTextFiles

func (t *TemplateObj) ParseTextFiles(line string, args ...Object) Object

func (*TemplateObj) ParseTextGlob

func (t *TemplateObj) ParseTextGlob(line string, args ...Object) Object

func (*TemplateObj) Templates

func (t *TemplateObj) Templates(line string, args ...Object) Object

func (*TemplateObj) Type

func (t *TemplateObj) Type() ObjectType

func (*TemplateObj) URLQueryEscaper

func (t *TemplateObj) URLQueryEscaper(line string, args ...Object) Object

type Throw

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

func (*Throw) CallMethod

func (t *Throw) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Throw) Inspect

func (t *Throw) Inspect() string

func (*Throw) Type

func (t *Throw) Type() ObjectType

type Throwable

type Throwable interface {
	// contains filtered or unexported methods
}

Whether the Object is throwable (STRING for now)

type TimeObj

type TimeObj struct {
	Tm    time.Time
	Valid bool
}

func ParseDuration

func ParseDuration(t *TimeObj, s string) (*TimeObj, error)

ParseDuration with support for Y(year), M(month) and D(day)

func (*TimeObj) Add

func (t *TimeObj) Add(line string, args ...Object) Object

func (*TimeObj) AddDate

func (t *TimeObj) AddDate(line string, args ...Object) Object

func (*TimeObj) After

func (t *TimeObj) After(line string, args ...Object) Object

func (*TimeObj) AppendFormat

func (t *TimeObj) AppendFormat(line string, args ...Object) Object

func (*TimeObj) Before

func (t *TimeObj) Before(line string, args ...Object) Object

func (*TimeObj) CallMethod

func (t *TimeObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*TimeObj) Clock

func (t *TimeObj) Clock(line string, args ...Object) Object

func (*TimeObj) Date

func (t *TimeObj) Date(line string, args ...Object) Object

func (*TimeObj) Day

func (t *TimeObj) Day(line string, args ...Object) Object

func (*TimeObj) Equal

func (t *TimeObj) Equal(line string, args ...Object) Object

func (*TimeObj) Format

func (t *TimeObj) Format(line string, args ...Object) Object

func (*TimeObj) FromEpoch

func (t *TimeObj) FromEpoch(line string, args ...Object) Object

func (*TimeObj) FullYear

func (t *TimeObj) FullYear(line string, args ...Object) Object

func (*TimeObj) Hours

func (t *TimeObj) Hours(line string, args ...Object) Object

func (*TimeObj) ISOWeek

func (t *TimeObj) ISOWeek(line string, args ...Object) Object

func (*TimeObj) Inspect

func (t *TimeObj) Inspect() string

func (*TimeObj) IsZero

func (t *TimeObj) IsZero(line string, args ...Object) Object

func (*TimeObj) Local

func (t *TimeObj) Local(line string, args ...Object) Object

func (*TimeObj) MarshalJSON

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

func (*TimeObj) Milliseconds

func (t *TimeObj) Milliseconds(line string, args ...Object) Object

func (*TimeObj) Minutes

func (t *TimeObj) Minutes(line string, args ...Object) Object

func (*TimeObj) Month

func (t *TimeObj) Month(line string, args ...Object) Object

func (*TimeObj) Parse

func (t *TimeObj) Parse(line string, args ...Object) Object

func (*TimeObj) Round

func (t *TimeObj) Round(line string, args ...Object) Object

func (*TimeObj) Scan

func (t *TimeObj) Scan(value interface{}) error

func (*TimeObj) Seconds

func (t *TimeObj) Seconds(line string, args ...Object) Object

func (*TimeObj) SetValid

func (t *TimeObj) SetValid(line string, args ...Object) Object

func (*TimeObj) Sleep

func (t *TimeObj) Sleep(line string, args ...Object) Object

func (*TimeObj) Strftime

func (t *TimeObj) Strftime(line string, args ...Object) Object

func (*TimeObj) Sub

func (t *TimeObj) Sub(line string, args ...Object) Object

func (*TimeObj) ToDateStr

func (t *TimeObj) ToDateStr(line string, args ...Object) Object

func (*TimeObj) ToEpoch

func (t *TimeObj) ToEpoch(line string, args ...Object) Object

func (*TimeObj) ToGMTStr

func (t *TimeObj) ToGMTStr(line string, args ...Object) Object

func (*TimeObj) ToISOStr

func (t *TimeObj) ToISOStr(line string, args ...Object) Object

func (*TimeObj) ToStr

func (t *TimeObj) ToStr(line string, args ...Object) Object

func (*TimeObj) ToTimeStr

func (t *TimeObj) ToTimeStr(line string, args ...Object) Object

func (*TimeObj) ToUTCStr

func (t *TimeObj) ToUTCStr(line string, args ...Object) Object

func (*TimeObj) Truncate

func (t *TimeObj) Truncate(line string, args ...Object) Object

func (*TimeObj) Type

func (t *TimeObj) Type() ObjectType

func (*TimeObj) UTC

func (t *TimeObj) UTC(line string, args ...Object) Object

func (*TimeObj) Unix

func (t *TimeObj) Unix(line string, args ...Object) Object

to timestamp(UTC)

func (*TimeObj) UnixLocal

func (t *TimeObj) UnixLocal(line string, args ...Object) Object

to timestamp(LOCAL)

func (*TimeObj) UnixLocalNano

func (t *TimeObj) UnixLocalNano(line string, args ...Object) Object

to timestamp(LOCAL)

func (*TimeObj) UnixNano

func (t *TimeObj) UnixNano(line string, args ...Object) Object

to timestamp(UTC)

func (*TimeObj) UnmarshalJSON

func (t *TimeObj) UnmarshalJSON(buf []byte) error

func (TimeObj) Value

func (t TimeObj) Value() (time.Time, bool, error)

Value returns time value, isValid and error object

func (*TimeObj) WeekDay

func (t *TimeObj) WeekDay(line string, args ...Object) Object

func (*TimeObj) Year

func (t *TimeObj) Year(line string, args ...Object) Object

func (*TimeObj) YearDay

func (t *TimeObj) YearDay(line string, args ...Object) Object

type Tuple

type Tuple struct {
	// Used in function return values.
	// if a function returns multiple values, they will wrap the results into a tuple,
	// the flag will be set to true
	IsMulti bool
	Members []Object
}

func (*Tuple) CallMethod

func (t *Tuple) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*Tuple) Count

func (t *Tuple) Count(line string, args ...Object) Object

func (*Tuple) Empty

func (t *Tuple) Empty(line string, args ...Object) Object

func (*Tuple) Filter

func (t *Tuple) Filter(line string, scope *Scope, args ...Object) Object

func (*Tuple) First

func (t *Tuple) First(line string, args ...Object) Object

func (*Tuple) Get

func (t *Tuple) Get(line string, args ...Object) Object

func (*Tuple) HashKey

func (t *Tuple) HashKey() HashKey

func (*Tuple) Index

func (t *Tuple) Index(line string, args ...Object) Object

func (*Tuple) Inspect

func (t *Tuple) Inspect() string

func (*Tuple) Last

func (t *Tuple) Last(line string, args ...Object) Object

func (*Tuple) Len

func (t *Tuple) Len(line string, args ...Object) Object

func (*Tuple) Map

func (t *Tuple) Map(line string, scope *Scope, args ...Object) Object

func (*Tuple) MarshalJSON

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

Json marshal handling

func (*Tuple) Merge

func (t *Tuple) Merge(line string, args ...Object) Object

func (*Tuple) Reduce

func (t *Tuple) Reduce(line string, scope *Scope, args ...Object) Object

func (*Tuple) Tail

func (t *Tuple) Tail(line string, args ...Object) Object

func (*Tuple) Type

func (t *Tuple) Type() ObjectType

type UIntSlice

type UIntSlice struct {
	UIntArr   []uint64
	SortOrder Ordering
}

UIntSlice attaches the methods of Interface to []int, sorting in ascending/descending order.

func (UIntSlice) Len

func (p UIntSlice) Len() int

func (UIntSlice) Less

func (p UIntSlice) Less(i, j int) bool

func (UIntSlice) Sort

func (p UIntSlice) Sort()

Sort is a convenience method.

func (UIntSlice) Swap

func (p UIntSlice) Swap(i, j int)

type UInteger

type UInteger struct {
	UInt64 uint64
	Valid  bool
}

func NewUInteger

func NewUInteger(i uint64) *UInteger

Returns a valid Unsigned Integer Object, that is Valid=true

func (*UInteger) CallMethod

func (i *UInteger) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*UInteger) Downto

func (i *UInteger) Downto(line string, args ...Object) Object

func (*UInteger) HashKey

func (u *UInteger) HashKey() HashKey

func (*UInteger) Inspect

func (i *UInteger) Inspect() string

func (*UInteger) IsEven

func (i *UInteger) IsEven(line string, args ...Object) Object

func (*UInteger) IsOdd

func (i *UInteger) IsOdd(line string, args ...Object) Object

func (*UInteger) IsValid

func (i *UInteger) IsValid(line string, args ...Object) Object

func (*UInteger) MarshalJSON

func (i *UInteger) MarshalJSON() ([]byte, error)

Json marshal handling

func (*UInteger) Next

func (i *UInteger) Next(line string, args ...Object) Object

func (*UInteger) Prev

func (i *UInteger) Prev(line string, args ...Object) Object

func (*UInteger) Scan

func (i *UInteger) Scan(value interface{}) error

Implements sql's Scanner Interface. So when calling sql.Rows.Scan(xxx), or sql.Row.Scan(xxx), we could pass this object to `Scan` method

func (*UInteger) SetValid

func (i *UInteger) SetValid(line string, args ...Object) Object

func (*UInteger) Str

func (i *UInteger) Str(line string, args ...Object) Object

func (*UInteger) Type

func (i *UInteger) Type() ObjectType

func (*UInteger) UnmarshalJSON

func (i *UInteger) UnmarshalJSON(b []byte) error

func (*UInteger) Upto

func (i *UInteger) Upto(line string, args ...Object) Object

func (UInteger) Value

func (i UInteger) Value() (driver.Value, error)

Implements driver's Valuer Interface. So when calling sql.Exec(xx), we could pass this object to `Exec` method

type UdpConnObject

type UdpConnObject struct {
	Conn    *net.UDPConn
	Address string
}

UDP connection object

func (*UdpConnObject) Addr

func (u *UdpConnObject) Addr(line string, args ...Object) Object

Return the remote address

func (*UdpConnObject) CallMethod

func (u *UdpConnObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*UdpConnObject) Close

func (u *UdpConnObject) Close(line string, args ...Object) Object

func (*UdpConnObject) Inspect

func (u *UdpConnObject) Inspect() string

func (*UdpConnObject) Read

func (u *UdpConnObject) Read(line string, args ...Object) Object

func (*UdpConnObject) SetDeadline

func (u *UdpConnObject) SetDeadline(line string, args ...Object) Object

func (*UdpConnObject) SetReadBuffer

func (u *UdpConnObject) SetReadBuffer(line string, args ...Object) Object

func (*UdpConnObject) SetReadDeadline

func (u *UdpConnObject) SetReadDeadline(line string, args ...Object) Object

func (*UdpConnObject) SetWriteBuffer

func (u *UdpConnObject) SetWriteBuffer(line string, args ...Object) Object

func (*UdpConnObject) SetWriteDeadline

func (u *UdpConnObject) SetWriteDeadline(line string, args ...Object) Object

func (*UdpConnObject) Type

func (u *UdpConnObject) Type() ObjectType

func (*UdpConnObject) Write

func (u *UdpConnObject) Write(line string, args ...Object) Object

type UnicodeObj

type UnicodeObj struct {
}

func NewUnicodeObj

func NewUnicodeObj() *UnicodeObj

func (*UnicodeObj) CallMethod

func (u *UnicodeObj) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*UnicodeObj) Inspect

func (u *UnicodeObj) Inspect() string

func (*UnicodeObj) IsControl

func (u *UnicodeObj) IsControl(line string, args ...Object) Object

func (*UnicodeObj) IsDigit

func (u *UnicodeObj) IsDigit(line string, args ...Object) Object

func (*UnicodeObj) IsGraphic

func (u *UnicodeObj) IsGraphic(line string, args ...Object) Object

func (*UnicodeObj) IsLetter

func (u *UnicodeObj) IsLetter(line string, args ...Object) Object

func (*UnicodeObj) IsLower

func (u *UnicodeObj) IsLower(line string, args ...Object) Object

func (*UnicodeObj) IsMark

func (u *UnicodeObj) IsMark(line string, args ...Object) Object

func (*UnicodeObj) IsNumber

func (u *UnicodeObj) IsNumber(line string, args ...Object) Object

func (*UnicodeObj) IsPrint

func (u *UnicodeObj) IsPrint(line string, args ...Object) Object

func (*UnicodeObj) IsPunct

func (u *UnicodeObj) IsPunct(line string, args ...Object) Object

func (*UnicodeObj) IsSpace

func (u *UnicodeObj) IsSpace(line string, args ...Object) Object

func (*UnicodeObj) IsSymbol

func (u *UnicodeObj) IsSymbol(line string, args ...Object) Object

func (*UnicodeObj) IsTitle

func (u *UnicodeObj) IsTitle(line string, args ...Object) Object

func (*UnicodeObj) IsUpper

func (u *UnicodeObj) IsUpper(line string, args ...Object) Object

func (*UnicodeObj) Type

func (u *UnicodeObj) Type() ObjectType

type UnixConnObject

type UnixConnObject struct {
	Conn    *net.UnixConn
	Address string
}

UNIX connection object

func (*UnixConnObject) Addr

func (u *UnixConnObject) Addr(line string, args ...Object) Object

Return the remote address

func (*UnixConnObject) CallMethod

func (u *UnixConnObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*UnixConnObject) Close

func (u *UnixConnObject) Close(line string, args ...Object) Object

func (*UnixConnObject) CloseRead

func (u *UnixConnObject) CloseRead(line string, args ...Object) Object

func (*UnixConnObject) CloseWrite

func (u *UnixConnObject) CloseWrite(line string, args ...Object) Object

func (*UnixConnObject) Inspect

func (u *UnixConnObject) Inspect() string

func (*UnixConnObject) Read

func (u *UnixConnObject) Read(line string, args ...Object) Object

func (*UnixConnObject) SetDeadline

func (u *UnixConnObject) SetDeadline(line string, args ...Object) Object

func (*UnixConnObject) SetReadBuffer

func (u *UnixConnObject) SetReadBuffer(line string, args ...Object) Object

func (*UnixConnObject) SetReadDeadline

func (u *UnixConnObject) SetReadDeadline(line string, args ...Object) Object

func (*UnixConnObject) SetWriteBuffer

func (u *UnixConnObject) SetWriteBuffer(line string, args ...Object) Object

func (*UnixConnObject) SetWriteDeadline

func (u *UnixConnObject) SetWriteDeadline(line string, args ...Object) Object

func (*UnixConnObject) Type

func (u *UnixConnObject) Type() ObjectType

func (*UnixConnObject) Write

func (u *UnixConnObject) Write(line string, args ...Object) Object

type UnixListenerObject

type UnixListenerObject struct {
	Listener *net.UnixListener
	Address  string
}

UNIX Listener object

func (*UnixListenerObject) AcceptUnix

func (l *UnixListenerObject) AcceptUnix(line string, args ...Object) Object

func (*UnixListenerObject) Addr

func (l *UnixListenerObject) Addr(line string, args ...Object) Object

func (*UnixListenerObject) CallMethod

func (l *UnixListenerObject) CallMethod(line string, scope *Scope, method string, args ...Object) Object

func (*UnixListenerObject) Close

func (l *UnixListenerObject) Close(line string, args ...Object) Object

func (*UnixListenerObject) Inspect

func (l *UnixListenerObject) Inspect() string

func (*UnixListenerObject) SetDeadline

func (l *UnixListenerObject) SetDeadline(line string, args ...Object) Object

func (*UnixListenerObject) Type

func (l *UnixListenerObject) Type() ObjectType

type WalkFunc

type WalkFunc func(route *Route, router *Router, ancestors []*Route) error

WalkFunc is the type of the function called for each route visited by Walk. At every invocation, it is given the current route, and the current router, and a list of ancestor routes that lead to the current route.

type Writable

type Writable interface {
	IOWriter() io.Writer
}

Whether the Object is the target of IO writer

Jump to

Keyboard shortcuts

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