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

Function compare_json_optional

nodedb-query/src/json_ops.rs:41–51  ·  view source on GitHub ↗

Compare two optional JSON values (for scan_filter compatibility).

(
    a: Option<&serde_json::Value>,
    b: Option<&serde_json::Value>,
)

Source from the content-addressed store, hash-verified

39
40/// Compare two optional JSON values (for scan_filter compatibility).
41pub fn compare_json_optional(
42 a: Option<&serde_json::Value>,
43 b: Option<&serde_json::Value>,
44) -> Ordering {
45 match (a, b) {
46 (None, None) => Ordering::Equal,
47 (None, Some(_)) => Ordering::Less,
48 (Some(_), None) => Ordering::Greater,
49 (Some(a), Some(b)) => compare_json(a, b),
50 }
51}
52
53/// Check equality with type coercion.
54///

Callers 1

matches_metadata_filterFunction · 0.70

Calls 1

compare_jsonFunction · 0.70

Tested by

no test coverage detected