pub enum Format {
JSONEachRow,
TabSeparated,
}Expand description
A ClickHouse input format for bulk inserts.
PHP: Utopia\Query\Builder\ClickHouse\Format.
Variants§
JSONEachRow
One JSON object per line.
TabSeparated
Tab-separated values, one row per line, \N for null.
Implementations§
Source§impl Format
impl Format
Sourcepub const PHP_CLASS: &'static str = "Utopia\\Query\\Builder\\ClickHouse\\Format"
pub const PHP_CLASS: &'static str = "Utopia\\Query\\Builder\\ClickHouse\\Format"
The PHP class of this enumeration.
Sourcepub fn try_from_value(value: &str) -> Option<Self>
pub fn try_from_value(value: &str) -> Option<Self>
The case with backing value value, if any.
PHP: tryFrom().
Sourcepub fn from_value(value: &str) -> Result<Self, Error>
pub fn from_value(value: &str) -> Result<Self, Error>
The case with backing value value.
PHP: from(), which throws ValueError (Error::InvalidValue) with the same message.
Source§impl Format
impl Format
Sourcepub fn serialize(
self,
rows: &[Array],
columns: Option<&[String]>,
) -> Result<String>
pub fn serialize( self, rows: &[Array], columns: Option<&[String]>, ) -> Result<String>
The rows in this format, one per line. With columns, each row has
exactly those columns in that order (missing ones are null).
PHP: Format::serialize().
use utopia_query::builder::Format;
use utopia_query::{Array, Value};
let mut row = Array::default();
row.set("id".into(), Value::Int(1));
row.set("note".into(), Value::Null);
assert_eq!(Format::TabSeparated.serialize(&[row.clone()], None)?, "1\t\\N");
assert_eq!(Format::JSONEachRow.serialize(&[row], None)?, r#"{"id":1,"note":null}"#);use Utopia\Query\Builder\ClickHouse\Format;
echo json_encode(Format::TabSeparated->serialize([['id' => 1, 'note' => null]])), "\n";
// "1\t\\N"
echo Format::JSONEachRow->serialize([['id' => 1, 'note' => null]]), "\n";
// {"id":1,"note":null}Trait Implementations§
impl Copy for Format
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Forget for Format
impl Freeze for Format
impl Move for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnsafeUnpin for Format
impl UnwindSafe for Format
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.