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

Function as_of_system_time_now

nodedb-sql/src/parser/preprocess/temporal.rs:533–550  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

531
532 #[test]
533 fn as_of_system_time_now() {
534 let before = std::time::SystemTime::now()
535 .duration_since(std::time::UNIX_EPOCH)
536 .unwrap()
537 .as_millis() as i64;
538 let ex = extract("SELECT * FROM array_slice('g', '{}') AS OF SYSTEM TIME NOW()")
539 .unwrap()
540 .unwrap();
541 let after = std::time::SystemTime::now()
542 .duration_since(std::time::UNIX_EPOCH)
543 .unwrap()
544 .as_millis() as i64;
545 let ts = ex.temporal.system_as_of_ms.unwrap();
546 assert!(
547 ts >= before && ts <= after,
548 "NOW() ts {ts} not in [{before}, {after}]"
549 );
550 }
551
552 #[test]
553 fn as_of_system_time_unsupported_expr_rejected() {

Callers

nothing calls this directly

Calls 4

nowFunction · 0.85
extractFunction · 0.85
duration_sinceMethod · 0.80
as_millisMethod · 0.45

Tested by

no test coverage detected