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

Function format_vector_array

nodedb-client/src/remote_parse.rs:90–93  ·  view source on GitHub ↗

Format an f32 slice as a SQL ARRAY literal: `ARRAY[0.1,0.2,0.3]`.

(v: &[f32])

Source from the content-addressed store, hash-verified

88
89/// Format an f32 slice as a SQL ARRAY literal: `ARRAY[0.1,0.2,0.3]`.
90pub(crate) fn format_vector_array(v: &[f32]) -> String {
91 let inner: Vec<String> = v.iter().map(|f| format!("{f}")).collect();
92 format!("ARRAY[{}]", inner.join(","))
93}
94
95#[cfg(test)]
96mod tests {

Callers 4

Calls 2

collectMethod · 0.80
iterMethod · 0.45

Tested by 2