Skip to main content

Module util

Module util 

Source
Expand description

Tiny shared helpers used across multiple modules.

Kept deliberately small — when in doubt, inline instead of growing this module. The helpers live here because they’d otherwise duplicate across meta_model.rs and feedback.rs (both need timestamps on persisted records, both default their storage to ~/.sphereql/, and both migrate legacy JSON-array stores to JSONL on first append).

Functions§

default_timestamp
Default persisted-record timestamp: seconds since Unix epoch, as a string. Sortable, unambiguous, and dependency-free. Callers that want a human-readable format should overwrite the timestamp field themselves (e.g. via with_timestamp).
migrate_legacy_array_to_jsonl
One-time migration of a legacy JSON-array store to JSONL, shared by the append paths in meta_model.rs and feedback.rs.
sphereql_home_dir
Resolve ~/.sphereql/ — the on-disk convention for SphereQL’s persistent training stores (meta_records.json, feedback_events.json).