| outline |
|
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | Custom Parameters Annotation | ||||||||||||||||||||||||||||
| titleTemplate | NpgsqlRest | ||||||||||||||||||||||||||||
| description | Set custom key-value configuration for PostgreSQL REST API endpoints. Add metadata and custom settings to endpoints. | ||||||||||||||||||||||||||||
| head |
|
Set custom key-value configuration for the endpoint.
@<key> = <value>
The @ prefix is optional - both @key = value and key = value work identically. Custom parameters with @ prefix are stored without the prefix (e.g., @my_param = value is stored as my_param).
Some parameters support dynamic values using the {param_name} format, where param_name references a function parameter. The value is resolved at runtime from the actual parameter value passed to the endpoint. The matching and substitution rules are shared across annotations — see Parameter Value Substitution.
create function upload_file(_path text, _file text)
returns void
language sql
begin atomic;
-- function body
end;
comment on function upload_file(text, text) is '
@upload for file_system
@file_system_path = {_path}
@file_system_file = {_file}
';Equivalent as a SQL file endpoint (sql/upload-file.sql):
/*
HTTP POST
@upload for file_system
@file_system_path = {path}
@file_system_file = {file}
@param $1 path
@param $2 file
*/
select;When called with {"_path": "/uploads/images", "_file": "photo.jpg"}, the file will be saved to /uploads/images/photo.jpg.
Many annotations support the @key = value syntax. The following sections link to where each parameter group is documented.
These parameters are predefined annotations that also support the key = value syntax:
- BUFFER_ROWS —
buffer_rows,buffer - RAW —
raw,raw_mode,raw_results - SEPARATOR —
separator,raw_separator - NEW_LINE —
new_line,raw_new_line - COLUMN_NAMES —
columns,names,column_names - CONNECTION —
connection,connection_name
Upload handlers accept custom parameters to control file processing behavior per-endpoint:
Per-endpoint control of HTML table and Excel spreadsheet rendering:
SSE annotations that also support the key = value syntax:
- SSE —
sse,sse_path,sse_events_path - SSE_EVENTS_LEVEL —
sse_level,sse_events_level - SSE_EVENTS_SCOPE —
sse_scope,sse_events_scope
Per-endpoint control of generated TypeScript client code:
- NpgsqlRest Options configuration - Configure default parameters
- Upload configuration - Configure upload handlers
- Table Format Options - Configure table format rendering
- Code Generation - Configure TypeScript client generation
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works