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

Function write_temp

nodedb/tests/sql_copy_from.rs:18–26  ·  view source on GitHub ↗

Write content to a temporary file and return its path. The caller is responsible for keeping the `tempfile::NamedTempFile` alive.

(content: &str, suffix: &str)

Source from the content-addressed store, hash-verified

16/// Write content to a temporary file and return its path.
17/// The caller is responsible for keeping the `tempfile::NamedTempFile` alive.
18fn write_temp(content: &str, suffix: &str) -> tempfile::NamedTempFile {
19 let mut f = tempfile::Builder::new()
20 .suffix(suffix)
21 .tempfile()
22 .expect("create temp file");
23 f.write_all(content.as_bytes()).expect("write temp file");
24 f.flush().expect("flush temp file");
25 f
26}
27
28/// Count rows in a collection via SELECT COUNT(*).
29async fn count_rows(srv: &TestServer, collection: &str) -> i64 {

Callers 8

copy_ndjson_roundtripFunction · 0.85
copy_csv_with_headerFunction · 0.85
copy_csv_header_falseFunction · 0.85
copy_timeseries_rejectedFunction · 0.85

Calls 3

expectMethod · 0.45
as_bytesMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected