Repository navigation
[ruby] expose driver timestamp semantics - #1536
Merged
Merged
Conversation
Contributor
Author
|
@brandur minor addition to the driver interface to avoid driver-specific concepts getting pulled into the driver-agnostic layer, lmk your thoughts? |
Driver consumers need to compare persisted timestamps without inspecting which database backend encodes them. Private SQL helpers also cannot be forwarded through delegating driver wrappers. Expose `normalize_time` and `time_precision` on the internal driver contract. Share normalization with SQL timestamp encoding and SQLite insertion formatting, preserving microsecond truncation on Postgres and millisecond rounding on SQLite. Return precision as an exact duration in seconds. Shared driver examples cover persisted queue and job timestamps at precision boundaries, UTC conversion, delegation, and the smallest representable increment across both adapters and database engines.
bgentry
force-pushed
the
bg/ruby-driver-time-contract
branch
from
October 25, 2026 02:24
0eb23cb to
fd87a0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Driver consumers that compare persisted timestamps need the driver's normalization and precision rules without inspecting its database backend.
Add
normalize_timeandtime_precisionto the internal driver contract. Share normalization with SQL timestamp encoding and SQLite insertion formatting, preserving microsecond truncation on Postgres and millisecond rounding on SQLite. Both operations are public on driver instances so delegating wrappers can forward them.