MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / translate_params

Function translate_params

nodedb-client/src/remote/sql.rs:157–161  ·  view source on GitHub ↗

Translate trait-level `&[Value]` parameters into owned, `ToSql`- compatible boxes for `tokio_postgres`. Returns one boxed parameter per input `Value`; the caller borrows them as `&[&(dyn ToSql + Sync)]` for the driver call. Unsupported value variants (objects, arrays, datetimes, etc.) return `Err` rather than silently coercing — surfacing the gap to the caller so the trait contract stays honest.

(
    params: &[Value],
)

Source from the content-addressed store, hash-verified

155/// `Err` rather than silently coercing — surfacing the gap to the
156/// caller so the trait contract stays honest.
157pub(super) fn translate_params(
158 params: &[Value],
159) -> NodeDbResult<Vec<Box<dyn tokio_postgres::types::ToSql + Sync + Send>>> {
160 params.iter().map(translate_value).collect()
161}
162
163fn translate_value(v: &Value) -> NodeDbResult<Box<dyn tokio_postgres::types::ToSql + Sync + Send>> {
164 match v {

Calls 2

collectMethod · 0.80
iterMethod · 0.45