Parameters
Parameters let the host application inject values into FQL queries. They are the primary way to pass dynamic data — user IDs, URLs, configuration values, thresholds — from Go into a script without string interpolation or query rewriting.
FQL parameter syntax
In FQL, parameters are referenced with the @ prefix:
Engine-level parameters
Parameters set on the engine apply as defaults to every session. Use these for values that rarely change — base URLs, API keys, environment names.
From Go values
WithParams accepts a map[string]any and converts each value to a runtime value automatically:
WithParam sets a single parameter:
From runtime values
When you already have a runtime.Value, use the runtime variants to skip conversion:
Session-level parameters
Session parameters override engine defaults for a single execution. Use these for per-request values — user context, request IDs, pagination offsets.
From Go values
From runtime values
Inspecting declared parameters
A compiled plan knows which parameters the query declares. Use plan.Params() to get the list:
This is useful for validating that all required parameters are provided before creating a session.
Supported Go types
WithParams and WithParam accept standard Go types that are converted to runtime values via runtime.ValueOf:
| Go type | Runtime value |
|---|---|
nil |
None |
bool |
Boolean |
int, int32, int64 |
Int |
float64 |
Float |
string |
String |
time.Time |
DateTime |
For complex structures like arrays and objects, build them using runtime.NewArray() and runtime.NewObject(), then pass them with the runtime param variants.
Example: parameterized query with per-session overrides
The greeting parameter is set at the engine level but overridden per session for Bob and Carol. The punctuation parameter uses the engine default for all sessions.