|
@@ -6,10 +6,10 @@ import (
|
|
|
)
|
|
|
|
|
|
type Context struct {
|
|
|
- vars map[string]interface{}
|
|
|
- ret [][]interface{}
|
|
|
-
|
|
|
- rep []string
|
|
|
+ vars map[string]interface{}
|
|
|
+ params []interface{}
|
|
|
+ ret [][]interface{}
|
|
|
+ rep []string
|
|
|
}
|
|
|
|
|
|
func NewContext() *Context {
|
|
@@ -42,6 +42,17 @@ func (sc *Context) Get(name string, valPtr ...interface{}) interface{} {
|
|
|
|
|
|
return sc.vars[name]
|
|
|
}
|
|
|
+func (sc *Context) Param(n uint, valPtr ...interface{}) interface{} {
|
|
|
+ if n > uint(len(sc.params)) {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ if len(valPtr) > 0 {
|
|
|
+ pv := reflect.ValueOf(valPtr[0])
|
|
|
+ pv.Elem().Set(reflect.ValueOf(sc.params[n]))
|
|
|
+ }
|
|
|
+
|
|
|
+ return sc.params[n]
|
|
|
+}
|
|
|
|
|
|
//Ret return the value from previous returns
|
|
|
func (sc *Context) Ret(n, i int) interface{} {
|