-
Notifications
You must be signed in to change notification settings - Fork 582
Open
Description
As in, it should be possible in a client to write:
ctx.subscription_builder()
.subscribe(format!(
"SELECT * FROM message WHERE sent >= {:?}",
Timestamp::now(),
))
.unwrap();
or the equivalent in C# or TypeScript, and wind up with a valid SQL query that SpacetimeDB will evaluate.
Currently, Timestamp
s print as raw us since the Unix epoch in Rust, and probably also in C#. I have no clue how printing objects works in TypeScript. OTOH, we parse them according to RFC 3339, which IIRC is roughly YYYY-MM-DDTHH:MM or whatever.
We have two obvious paths to unify this:
- Change
Timestamp
in Rust, C# and TypeScript to print as RFC 3339. In Rust, the time crate seems to do this. Presumably C# and TypeScript will also give us ways to make it happen with relatively little investment of engineer-hours. Note that we can almost certainly get away with unconditionally printing as UTC, or local time, or whatever's easiest, even if we're inconsistent between impls. - Extend our SQL parser to accept a raw integer literal for
Timestamp
s and treat it as a number of us since the Unix epoch. I am unsure how much effort this would be, as I don't know to what extent we control our SQL parser.
Metadata
Metadata
Assignees
Labels
No labels