with_param
Small wrapper around with_option for impl Serialize + Bind
Aside from the simpler types, the following needs testing:
- Arrays, Maps, Tuples (e.g., common container types that make sense to use in this context).
- DateTime/DateTime64 (IIRC, it requires a specific format like
2022-05-02 13:25:55.123456789, i.e. not exactly ISO timestamp) - Numeric and named enums
\t,\r,\n, single quotes, backslashes in the bound strings- Strings with UTF8 symbols
- Nulls
I'd maybe also not mix it with .with_option method; the proposal from @mshustov looks better IMO (see this comment) - we can add the param_ prefix ourselves internally.
So already found issue with basic tests. String Bind serializes to 'string' with quotes which is correct when interpolating into query string, but for server side parameters the string should be unquoted
Note once a string is contained it is expected to be quoted in params: https://github.com/ClickHouse/clickhouse-connect/issues/159
We also need tests for UUID (probably, with the human-readable mode it works already). Also, for some implementation of DecimalX (the fixnum crate for instance).
And need to add some examples.
@loyd, I'd like to merge this one. WDYT?