HTTP request variables wrapper.
Returns request variable boolean value.
Parameters:
key
Variable name.
Returns:
Variable value as Bool
.
getDynamic (key:String):Dynamic
Returns request variable float value.
Parameters:
key
Variable name.
Returns:
Variable value as Float
.
Returns request variable string value.
Parameters:
key
Variable name.
Returns:
Variable value as String
.
getTyped (str:String):{val:Dynamic, name:String}
Returns parsed variable value according to type supplied in string <type>:<name>
.
Usage cheatsheet:
// basic int value
vars.getTyped('test');
vars.getTyped('int:test');
// basic float value
vars.getTyped('float:test');
// JSON encoded string, returns anonymous object
vars.getTyped('json:test');
// checkbox, returns boolean
vars.getTyped('checkbox:test');
// string
vars.getTyped('string:test');
Parameters:
str
Typed variable name.
Returns:
name - Variable name. val - Variable value.
getTypedSQL (str:String, ?defval:String):{val:String, name:String}
Returns parsed variable value ready for SQL queries according to type supplied in string <type>:<name>
.
Usage cheatsheet:
// basic value without any manipulation
vars.getTypedSQL('test');
// basic int value without any manipulation
vars.getTypedSQL('int:test');
// checkbox, convert value into SQL boolean string (`'t'` or `'f'`)
vars.getTypedSQL('checkbox:test');
// date, convert date/time string DD.MM.YYYY -> YYYY-MM-DD
vars.getTypedSQL('date:test');
// date and time, convert date/time string DD.MM.YYYY HH:MM -> YYYY-MM-DD HH:MM
vars.getTypedSQL('datetime:test');
// current date and time (`now()`)
vars.getTypedSQL('now:test');
Parameters:
str
Typed variable name.
defval
Default variable value. Will be used if the variable does not exist.
Returns:
name - Variable name. val - Variable value.
inline set (key:String, val:Dynamic):Void
Sets request variable value as a string.
Parameters:
key
Variable name.
val
Variable value. Will be converted to string before setting.
inline setDynamic (key:String, val:Dynamic):Void