You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand, ParamValueConverterRegistry is responsible for converting query parameters into a usable format for the HTTP API.
RequestFactory and ParamValueConverterRegistry are both implemented as final, so there is no way to apply any customization in the userland.
Use Case
For my current use case, I would like to change the way of transmitting any time-related value to my ClickHouse instance. I am using DateTimeInterface compatible objects in my code and pass them as parameters to clickhouse, but this library strips the timezone information:
$client->selectWithParams('SELECT foo FROM bar WHERE ts < {MyDatetime:Datetime}', [
'MyDatetime' => newDateTimeImmutable('2024-12-04T14:44:05+01:00')
]);
The readme clearly states that it's my obligation to correctly handle timezones and pass them to the library in a way that the clickhouse instance can process it (and/or use the timezone conversion of the library).
However, I'd prefer to have my datetime objects converted to a unix timestamp instead (or a ISO8601 string with tz/offset information and then have Clickhouse parse that with date_time_input_format=best_effort.
Possible Solutions
Removing final from ParamValueConverterRegistry
Allow overwriting the default value converters inside ParamValueConverterRegistry, either by passing them to the constructor or by adding a setConverter (string $type, callable $closure) method (personally preferred)
Obviously, there are more possible solutiouns, but these seem to be the least intrusive to me.
Let me know what you think, I'm happy to provide a PR.
The text was updated successfully, but these errors were encountered:
Abstract
The current constructor of the
Psr17Client
requires an instance ofRequestFactory
which then requires an instance ofParamValueConverterRegistry
.As far as I understand,
ParamValueConverterRegistry
is responsible for converting query parameters into a usable format for the HTTP API.RequestFactory
andParamValueConverterRegistry
are both implemented asfinal
, so there is no way to apply any customization in the userland.Use Case
For my current use case, I would like to change the way of transmitting any time-related value to my ClickHouse instance. I am using
DateTimeInterface
compatible objects in my code and pass them as parameters to clickhouse, but this library strips the timezone information:The parameter is being sent as
The readme clearly states that it's my obligation to correctly handle timezones and pass them to the library in a way that the clickhouse instance can process it (and/or use the timezone conversion of the library).
However, I'd prefer to have my datetime objects converted to a unix timestamp instead (or a ISO8601 string with tz/offset information and then have Clickhouse parse that with
date_time_input_format=best_effort
.Possible Solutions
final
fromParamValueConverterRegistry
ParamValueConverterRegistry
, either by passing them to the constructor or by adding asetConverter (string $type, callable $closure)
method (personally preferred)Obviously, there are more possible solutiouns, but these seem to be the least intrusive to me.
Let me know what you think, I'm happy to provide a PR.
The text was updated successfully, but these errors were encountered: