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

Function parse_spatial_key

nodedb/src/data/executor/spatial_checkpoint.rs:197–204  ·  view source on GitHub ↗

Parse a key string of the form "{tid}:{collection}:{field}" into a tuple. Returns `None` if the string doesn't have at least two ':' separators.

(key: &str)

Source from the content-addressed store, hash-verified

195/// Parse a key string of the form "{tid}:{collection}:{field}" into a tuple.
196/// Returns `None` if the string doesn't have at least two ':' separators.
197fn parse_spatial_key(key: &str) -> Option<(crate::types::TenantId, String, String)> {
198 let mut parts = key.splitn(3, ':');
199 let tid_str = parts.next()?;
200 let coll = parts.next()?.to_string();
201 let field = parts.next().unwrap_or("").to_string();
202 let tid_u64: u64 = tid_str.parse().ok()?;
203 Some((crate::types::TenantId::new(tid_u64), coll, field))
204}

Callers 1

Calls 4

to_stringMethod · 0.80
nextMethod · 0.45
okMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected