-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(param-value-converter-registry): wider date converters input type and throw exception #287
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #287 +/- ##
==========================================
- Coverage 94.97% 94.65% -0.33%
==========================================
Files 40 40
Lines 737 749 +12
==========================================
+ Hits 700 709 +9
- Misses 37 40 +3 ☔ View full report in Codecov by Sentry. |
While I like the idea of the library handling the timezone issue, I have two converns. They are my personal preference and it's your library, so feel free to ignore them :) First, my approach is to eliminate the need of timezone conversions in my application entirely, because it requires me to keep my stack settings synced, e.g. all ClickHouse instances need to be on the same timezone and my application code needs to know about this timezone. While this isn't necessarily a hard thing to achieve, I am still aiming to avoid it by transmitting timezone relevant data as explicit as possible because even though it's unlikely to happen that a misconfigured timezone on a ClickHouse instance in a cluster messes up time data, I'd prefer if it were impossible. Secondly, I think this is already quite a specific implementation detail. I suggested the custom value converter solution before because then it's a userland decision of how to handle Another approach could be a mix between this PR and #286: We allow passing custom value converters and also provide a set of timezone-conversion value converters that are not applied by default, but can be used by overwriting existing converters: readonly final class DateTimeConverters {
static function createWithTimezone (\DateTimeZone|null $clickHouseTimezone) {
return [
'date' => self::dateConverter($clickHouseTimezone),
'date32' => self::dateConverter($clickHouseTimezone),
...,
}
}
new ParamValueConverterRegistry(DateTimeConverters::createWithTimezone($myClickhouseTimezone)); What would you think about that? Users can opt in to use the library handling TZ conversions, I can opt in to have my values converted to unix timestamps. |
FYI I'm definitely planning to merge #286, forgot to mention that. |
727f767
to
c443273
Compare
… type and throw exception
No description provided.