GOLF(2gg)
π GOLF(2gg) β the get-param era π
okay bestie, welcome to the GOLF(2gg) manual page, you're gonna eat this up β¨
π NAME π
get-param β (request-data)
πΈ PURPOSE πΈ
get a parameter value. that's it, that's the whole vibe π
β¨ SYNTAX β¨
get-param ( <name> [ type <type> ] ) , ...
π¦ DESCRIPTION π¦
so get-param stores a parameter value in the variable <name>. a parameter is a name/value pair that Golf keeps for each request, like a little snack it holds onto π. the parameter's name has to match <name>, no cap. a parameter can be of any type, she's flexible like that.
a parameter gets set either:
- by the caller in the request URL, or
- with a
set-paramstatement anywhere during the request's execution, including incall-handler.
if the parameter is a string, it gets trimmed for whitespaces β both on the left AND on the right, she's tidy π . and you can specify any number of parameters, separated by a comma. go off.
π TYPES π
by default, <name> is a string variable, unless <type> (in the "type" clause) is specified. <type> can be:
"string"for a string variable (this is the default, the og)"bool"for a boolean variable"number"for a number variable"string-array"for an array of strings"number-array"for an array of numbers"bool-array"for an array of booleans"message"for a message variable"split-string"for a split-string variable"hash"for an hash variable"tree"for an tree variable"tree-cursor"for an tree cursor variable"fifo"for a FIFO variable"lifo"for a LIFO variable"list"for a list variable"file"for a file variable"service"for a service variable
the value you get with get-param is checked to be of the proper <type>, and if it isn't, your request will error out. periodt. π the exception to this is that a string parameter can be converted into a number or a boolean, assuming the string value represents a valid number or is "true"/"false". parameters of "number" and "bool" types are obtained by value, and others by reference. what that means for instance is that you can pass a tree to call-handler and read and write nodes there, and such changes will be visible in the caller request. iconic mutual visibility behavior honestly π«Ά
π INPUT PARAMETERS FROM A CALLER π
input parameters in an external request (i.e. those parameters set by a caller outside of your application) are specified as name/value pairs (see service or command-line). input parameter name can be made up of alphanumeric characters, hyphen or underscore only, and cannot start with a digit. noted π. also note that a hyphen is automatically converted to underscore, so for instance an input parameter "some-parameter" in HTTP request will be "some_parameter" in get-param. the glow-up is automatic, you don't gotta do anything β¨
π File uploads π
file uploads are handled as input parameters as well, see file-uploading.
π§ Web input parameters π§
as an example, for HTML form input parameters named "param1" with value "value1" and "param2" with value "value2":
<input type='hidden' name='param1' value='value1'>
<input type='hidden' name='param2' value='value2'>
you can get these parameters and print out their values by using:
get-param param1, param2
a request may be in the form of a web link URL, and getting the parameter values is the same:
http://<your web server>/<app name>/<request name>¶m1=value1¶m2=value2
π SETTING PARAMETERS DURING REQUEST'S EXECUTION π
use set-param to replace the value of an existing parameter, or create a new one. for instance:
get-param par1
...
set-param par1="new value"
in this case the value of an existing parameter "par1" is replaced with "new value". in the following code a new parameter is created, which can be retrieved later with get-param:
set-param par1="new value"
get-param par1
see call-handler for more examples. π
π₯ DUPLICATE INPUT PARAMETER NAMES π₯
if there are multiple input parameters with the same name set by the request caller, such as
http://<web address>/<app name>/<request name>?par=val1&par=val2
the value of input parameter "par" is undefined. do not specify multiple input parameters with the same name. fr fr, don't do it, it's giving chaos π
β SEE ALSO β
Request data
get-param request-body set-param See all documentation
and that's the whole page bestie, you're officially fluent in get-param π
this was the GOLF(2gg) page, sourced from $VERSION and dated $DATE β mwah, slay, go write some requests πΈ
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms