Skip to content

feat(dbtype): time-based ID range queries for UUIDv7 and Int64#45

Draft
klaidliadon wants to merge 5 commits intomasterfrom
feat/timerange
Draft

feat(dbtype): time-based ID range queries for UUIDv7 and Int64#45
klaidliadon wants to merge 5 commits intomasterfrom
feat/timerange

Conversation

@klaidliadon
Copy link
Copy Markdown
Contributor

Summary

  • Add FloorUUIDv7 / CeilUUIDv7 / UUIDv7Time — synthetic UUIDv7 bounds and timestamp extraction using raw [16]byte, no external deps
  • Add FloorInt64ID / CeilInt64ID / Int64IDTime — same for timestamp-embedded int64 IDs (typeid bit layout)
  • Add TimeRange squirrel.Sqlizer that brackets a PK column with floor/ceil bounds derived from timestamps — enables WHERE id BETWEEN floor AND ceil queries using the PK index instead of a separate created_at column
  • Convenience constructors: UUIDv7Range and Int64IDRange

Test plan

  • 7 UUIDv7 tests: version/variant correctness, floor < real ordering, ceil > floor, bracket property, timestamp round-trip
  • 5 Int64ID tests: floor/ceil ordering, bracket, timestamp round-trip, extraction
  • 8 TimeRange tests: all four SQL output cases, accessor booleans, bound value correctness for both UUID and int64
  • Existing bigint tests unaffected (24 total tests pass)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant