Skip to main content

fetch_row

Function fetch_row 

Source
pub async fn fetch_row(
    table: &str,
    columns: &[ColumnInfo],
    pk: &[(String, Value)],
) -> Result<Option<Value>, AppError>
Expand description

Fetches one row identified by pk, if it still exists - used to prefill an edit form. pk originates from a query string a user can tamper with, so both its column names ([require_known_pk_columns]) and its values (bind_any) are validated/bound before any SQL is built - unlike run_raw’s deliberately-unrestricted user-typed SQL.