pub struct Param(/* private fields */);Expand description
The value of a query parameter, made from a Rust value with into():
what Query::param and
Exec::param take.
The SQL says each parameter’s type ({id:UInt64}), and ClickHouse parses
the value as that type on the server, so a value only has to be readable as
it: an i64 is a fine UInt8 parameter if it is in range, and a string is
a fine Decimal, IPv4 or DateTime one in its text form.
| Rust | Sent as |
|---|---|
integers, floats, bool | the number, true/false |
&str, String | the text |
Vec<u8>, &[u8] | the bytes, as a String |
uuid::Uuid | the hyphenated form |
chrono::DateTime<Utc>, chrono::NaiveDateTime (as UTC) | Unix seconds with a fraction, so no time zone applies |
chrono::NaiveDate | YYYY-MM-DD |
std::net::IpAddr and its variants | dotted / RFC 5952 text |
Option<T> | T, or NULL for None (declare the type Nullable(…)) |
Vec<T> (T not u8) | an array |
HashMap<K, V>, BTreeMap<K, V> | a map |
Value | the value as it is: the explicit form, for any type |
The explicit form covers what has no Rust type here, such as a decimal’s
exact text, Value::Decimal("12.30".into()), or a tuple,
Value::Tuple(vec![1i64.into(), "a".into()]).
Implementations§
Trait Implementations§
impl ArrayElement for Param
Source§impl From<NaiveDateTime> for Param
impl From<NaiveDateTime> for Param
Source§fn from(v: NaiveDateTime) -> Self
fn from(v: NaiveDateTime) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Param
Auto Trait Implementations§
impl Forget for Param
impl Freeze for Param
impl Move for Param
impl RefUnwindSafe for Param
impl Send for Param
impl Sync for Param
impl Unpin for Param
impl UnsafeUnpin for Param
impl UnwindSafe for Param
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.