pub struct ValueWriter<'a> { /* private fields */ }Expand description
Writes an individual value to a column.
Implementations§
Source§impl<'a> ValueWriter<'a>
impl<'a> ValueWriter<'a>
Sourcepub fn column_type(&self) -> &'a DataTypeNode
pub fn column_type(&self) -> &'a DataTypeNode
The data type of the target column.
Sourcepub fn write_fixed(&mut self, bytes: &[u8]) -> Result<(), ValueWriteError>
pub fn write_fixed(&mut self, bytes: &[u8]) -> Result<(), ValueWriteError>
Write a value to a fixed-width column.
§Errors
ValueWriteError::IncorrectMethodif the data type is not fixed-width.ValueWriteError::InvalidLengthif the data type is a different width than the number of bytes written.
Sourcepub fn write_string(
&mut self,
string_bytes: &[u8],
) -> Result<(), ValueWriteError>
pub fn write_string( &mut self, string_bytes: &[u8], ) -> Result<(), ValueWriteError>
Write a string value to the column.
ClickHouse strings are not required to be UTF-8, so this method accepts arbitrary bytes.
§Note
Types writing to a FixedString column should check the declared length through
Self::column_type() and call Self::write_fixed() instead.
Sourcepub fn write_null(&mut self) -> Result<(), ValueWriteError>
pub fn write_null(&mut self) -> Result<(), ValueWriteError>
Write a null value to the column.
§Errors
ValueWriteError::UnexpectedNullif the column type is notNullable(_).
Sourcepub fn write_array<T>(&mut self) -> Result<ArrayWriter<'_, T>, ArrayWriteError>where
T: Encode,
pub fn write_array<T>(&mut self) -> Result<ArrayWriter<'_, T>, ArrayWriteError>where
T: Encode,
Begin writing an array to the column.
See ArrayWriter for details.
§Errors
ArrayWriteError::NotAnArrayif the column type is notArray(_).ArrayWriteError::IncompatibleTypeifTis not compatible with the column type, as determined byEncode::compatible().
Sourcepub fn write_tuple(&mut self) -> Result<TupleWriter<'_>, TupleWriteError>
pub fn write_tuple(&mut self) -> Result<TupleWriter<'_>, TupleWriteError>
Begin writing a tuple to the column.
See TupleWriter for details.
§Errors
TupleWriteError::NotATupleif the column type is notTuple(...)orNullable(Tuple(...))(experimental type).
Sourcepub fn write_map<K, V>(&mut self) -> Result<MapWriter<'_, K, V>, MapWriteError>
pub fn write_map<K, V>(&mut self) -> Result<MapWriter<'_, K, V>, MapWriteError>
Begin writing a map to the column.
See MapWriter for details.
§Errors
MapWriteError::NotAMapif the column type is notMap(...).MapWriteError::IncompatibleKeyTypeifKis not compatible with the map’s key type, according toEncode::compatible().MapWriteError::IncompatibleValueTypeifVis not compatible with the map’s value type, according toEncode::compatible().
Auto Trait Implementations§
impl<'a> !UnwindSafe for ValueWriter<'a>
impl<'a> Freeze for ValueWriter<'a>
impl<'a> RefUnwindSafe for ValueWriter<'a>
impl<'a> Send for ValueWriter<'a>
impl<'a> Sync for ValueWriter<'a>
impl<'a> Unpin for ValueWriter<'a>
impl<'a> UnsafeUnpin for ValueWriter<'a>
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