Parameters in SQL and TypeScript share the same implementation; only their declaration methods differ.
Declaration
SQL
There is only one parameter namespace in SQL, meaning parameters are shared across different queries.
Typing @param will trigger the Monaco Editor's snippet autocomplete.
-- @param uid / number / label="User ID"; default=11
select * from `user` where id = ${uid};
delete from `user` where id = ${uid};Declaring multiple parameters in SQL:
-- @param uid / number
-- @param name
-- @param info / string / kind=json
-- @param instantv / instant
-- > default="2025-07-17 02:12:12"; tz="America/Bahia";
-- > min="2025-04-17 02:12:12"; max="2025-09-17 05:12:12";
-- @param intv / bigint
-- > min=7; max=45; default=121;TIP
You can use the > character at the beginning of a comment line to split long parameter definitions across multiple lines for better readability.
Only the options (key=value pairs) can be wrapped this way; the parameter name and type must remain on the first line.
Referencing another parameter with <- name in SQL (Forward references are allowed, but circular references are not.):
-- @param uid / uint / label=User ID; default=34
select * from `user` where id = ${uid};
-- @param delete_uid / <- uid / label=User ID to delete
delete from `user` where id = ${delete_uid};TypeScript
In TypeScript, parameters are declared and passed as explicit variable instances:
redisshell((cli) => {
const key = params.string("key", { default: "hello" });
const value = params.string("value", { default: "world" });
// Note: Param instances cannot be directly used in operations.
// Use `valmap` if needed.
// For example, the following code is incorrect:
value.trim().toUpperCase();
// Correct approach: Use `valmap` for operations:
const value = params.string("value", {
default: "world",
valmap: (v) => v.trim().toUpperCase(),
});
cli.get(key);
cli.set(key, value);
});Parameter Types & Options
Number Parameters
- max/min
- default
- nullable: If
nullableis false (default) and no default value is provided, the parameter defaults to the type's zero value (e.g., 0 for number). Ifnullableis true, the parameter defaults tonull.
Decimal Parameters
Same as Number
Bigint Parameters
Same as Number
Boolean Parameters
- default
- nullable
String Parameters
- default
- nullable
- kind: Accepts
jsonortextarea, used to provide a better UI input experience.
Datetime Parameters
- max/min
- default
- nullable
The value format must be 2026-06-02 11:29:34[.123456789]
Date Parameters
Same as Datetime
Instant Parameters
Same as Datetime
- tz: timezone
This type sends a unixnanos to Go runtime, not datetime string.
Bytes Parameters
- default
- nullable
The value format must be base64 string.