pub fn build_insert_sql(
entity: &str,
data: &Value,
) -> Result<(String, Vec<JsonParam>), StorageError>Expand description
Build an INSERT SQL statement and collect typed parameter values.
Returns (sql, params) where params[0] is the generated ID
(always JsonParam::Text). Subsequent params carry the JSON-typed
value so the postgres driver can bind them to typed columns
(INTEGER / BOOLEAN / TIMESTAMPTZ / TEXT) and so JSON null reaches
the database as SQL NULL — the previous string-collapsing path stored
"" for nullable FKs and broke any non-text column.