Documentation ¶
Index ¶
- Variables
- func CheckForArgumentCount(vm *otto.Otto, call otto.FunctionCall, want int)
- func GetEmptyObject(vm *otto.Otto) *otto.Object
- func GetQueryValues(queryString string) map[string]interface{}
- func ParseURLFromFilename(filename string) (string, string, error)
- func ToIntFromValue(value otto.Value, defaultVal int) int
- func ToStringFromVM(vm *otto.Otto, key, defaultVal string) string
- func ToStringFromValue(val otto.Value, defaultVal string) string
- func ToValueFromString(str string) otto.Value
- func UpdateEnginePathVars(baseDir string)
- type Bundle
- type JSFunc
- type ProgramPath
- type URLPath
Constants ¶
This section is empty.
Variables ¶
var ( // ModuleDirPath is modules directory of project ModuleDirPath string // HandlerDirPath is handlers directory of project HandlerDirPath string // EventDirPath is events directory of project EventDirPath string // FileDirPath : FileDirPath string // PackageDirPath is the directory that contains 3rd party modules PackageDirPath string // BasePath is the main directory of application BasePath string )
Functions ¶
func CheckForArgumentCount ¶
func CheckForArgumentCount(vm *otto.Otto, call otto.FunctionCall, want int)
CheckForArgumentCount checks for argument count. if got and want values are not equal, panic
func GetEmptyObject ¶
GetEmptyObject returns {} (empty javascript object)
func GetQueryValues ¶
GetQueryValues :
func ParseURLFromFilename ¶
ParseURLFromFilename take file name of script. returns URL and method if it's defined in filename,
otherwise returns ALL method
i.e "/test/file.js" -> ("/test/file", "ALL")
"/test/file.post.js" -> ("test/file", "POST") "/test/folder/index.js" ("test/folder","ALL")
func ToIntFromValue ¶
ToIntFromValue parses a value to integer. if an error occured, returns given default value
func ToStringFromVM ¶
ToStringFromVM parse string from vm
func ToStringFromValue ¶
ToStringFromValue parses a value to string
func ToValueFromString ¶
ToValueFromString must parse value from string
func UpdateEnginePathVars ¶
func UpdateEnginePathVars(baseDir string)
UpdateEnginePathVars update path variables depends on given base dir
Types ¶
type Bundle ¶
type Bundle struct { Program *ast.Program Filename ProgramPath }
Bundle is parsed javascript files ready to execution
type JSFunc ¶
type JSFunc func(call otto.FunctionCall) otto.Value
JSFunc presents javascript function
type ProgramPath ¶
type ProgramPath string
ProgramPath is path of a progrm
func NewProgramPath ¶
func NewProgramPath(path string) ProgramPath
NewProgramPath returns a new ProgramPath