Skip to main content

Module util

Module util 

Source
Expand description

Shared utilities used across faucet source and sink crates.

Constants§

DEFAULT_ERROR_BODY_MAX_LEN
Default maximum body length for error responses.

Functions§

check_http_response
Check an HTTP response status and return a FaucetError::HttpStatus on non-success responses.
extract_context
Extract context values from a record using JSONPath expressions.
extract_records
Extract records from a JSON value using an optional JSONPath expression.
quote_ident
Quote a SQL identifier to prevent SQL injection.
substitute_context
Substitute {key} placeholders in a template string with values from context.
substitute_context_bind_params
Replace {key} placeholders with SQL bind-parameter markers, returning the rewritten query and an ordered list of values to bind.
substitute_context_json
Substitute {key} placeholders within a serialized JSON string, escaping string values so that the result remains valid JSON.