Struct taos_query::common::raw::RawBlock
source · pub struct RawBlock { /* private fields */ }
Expand description
Raw data block format (B for bytes):
+-----+----------+---------------+-----------+-----------------------+-----------------+
| header | col_schema... | length... | (bitmap or offsets | col data) ... |
| 28 B | (1+4)B * cols | 4B * cols | (row+7)/8 or 4 * rows | length[col] ... |
+-----+----------+---------------+-----------+-----------------------+-----------------+
The length of bitmap is decided by number of rows of this data block, and the length of each column data is recorded in the first segment, next to the struct header
Implementations§
source§impl RawBlock
impl RawBlock
pub fn from_views(views: &[ColumnView], precision: Precision) -> Self
sourcepub unsafe fn parse_from_ptr(ptr: *mut c_void, precision: Precision) -> Self
pub unsafe fn parse_from_ptr(ptr: *mut c_void, precision: Precision) -> Self
§Safety
When using this with correct TDengine 3.x raw block pointer, it’s safe.
sourcepub unsafe fn parse_from_ptr_v2(
ptr: *const *const c_void,
fields: &[Field],
lengths: &[u32],
rows: usize,
precision: Precision
) -> Self
pub unsafe fn parse_from_ptr_v2( ptr: *const *const c_void, fields: &[Field], lengths: &[u32], rows: usize, precision: Precision ) -> Self
§Safety
When using this with correct TDengine 2.x block pointer, it’s safe.
pub fn parse_from_raw_block_v2( bytes: impl Into<Bytes>, fields: &[Field], lengths: &[u32], rows: usize, precision: Precision ) -> Self
pub fn parse_from_raw_block( bytes: impl Into<Bytes>, precision: Precision ) -> Self
sourcepub fn with_database_name(&mut self, name: impl Into<String>) -> &mut Self
pub fn with_database_name(&mut self, name: impl Into<String>) -> &mut Self
Set table name of the block
sourcepub fn with_table_name(&mut self, name: impl Into<String>) -> &mut Self
pub fn with_table_name(&mut self, name: impl Into<String>) -> &mut Self
Set table name of the block
sourcepub fn with_field_names<S: Display, I: IntoIterator<Item = S>>(
&mut self,
names: I
) -> &mut Self
pub fn with_field_names<S: Display, I: IntoIterator<Item = S>>( &mut self, names: I ) -> &mut Self
Set field names of the block
pub const fn group_id(&self) -> u64
pub fn table_name(&self) -> Option<&str>
pub fn tmq_db_name(&self) -> Option<&str>
pub fn schemas(&self) -> &[ColSchema]
sourcepub fn field_names(&self) -> &[String]
pub fn field_names(&self) -> &[String]
Get field names.
sourcepub fn columns(&self) -> Iter<'_, ColumnView>
pub fn columns(&self) -> Iter<'_, ColumnView>
Data view in columns.
pub fn column_views(&self) -> &[ColumnView]
pub fn into_rows<'a>(self) -> IntoRowsIter<'a> ⓘwhere
Self: 'a,
pub fn deserialize<'de, 'a: 'de, T>(
&'a self
) -> Map<RowsIter<'_>, fn(_: RowView<'a>) -> Result<T, Error>>where
T: Deserialize<'de>,
pub fn as_raw_bytes(&self) -> &[u8] ⓘ
pub fn is_null(&self, row: usize, col: usize) -> bool
sourcepub unsafe fn get_raw_value_unchecked(
&self,
row: usize,
col: usize
) -> (Ty, u32, *const c_void)
pub unsafe fn get_raw_value_unchecked( &self, row: usize, col: usize ) -> (Ty, u32, *const c_void)
pub fn get_ref(&self, row: usize, col: usize) -> Option<BorrowedValue<'_>>
sourcepub unsafe fn get_ref_unchecked(
&self,
row: usize,
col: usize
) -> BorrowedValue<'_>
pub unsafe fn get_ref_unchecked( &self, row: usize, col: usize ) -> BorrowedValue<'_>
Get one value at (row, col)
of the block.
§Safety
Ensure that row
and col
not exceed the limit of the block.
pub fn to_values(&self) -> Vec<Vec<Value>>
pub fn write<W: Write>(&self, _wtr: W) -> Result<usize>
pub fn fields(&self) -> Vec<Field>
pub fn pretty_format(&self) -> PrettyBlock<'_>
pub fn to_create(&self) -> Option<MetaCreate>
sourcepub fn cast_precision(&self, precision: Precision) -> Self
pub fn cast_precision(&self, precision: Precision) -> Self
Cast the block into a new block with new precision.
Trait Implementations§
source§impl AsyncInlinable for RawBlock
impl AsyncInlinable for RawBlock
fn read_optional_inlined<'life0, 'async_trait, R>( reader: &'life0 mut R ) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>
source§fn read_inlined<'life0, 'async_trait, R>(
reader: &'life0 mut R
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
fn read_inlined<'life0, 'async_trait, R>( reader: &'life0 mut R ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
Read inlined bytes into object.
source§fn write_inlined<'life0, 'life1, 'async_trait, W>(
&'life0 self,
wtr: &'life1 mut W
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + Send + Unpin,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_inlined<'life0, 'life1, 'async_trait, W>(
&'life0 self,
wtr: &'life1 mut W
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + Send + Unpin,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write inlined bytes to a writer.
source§fn write_inlined_with<'life0, 'life1, 'async_trait, W>(
&'life0 self,
wtr: &'life1 mut W,
_opts: InlineOpts
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + Send + Unpin,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_inlined_with<'life0, 'life1, 'async_trait, W>(
&'life0 self,
wtr: &'life1 mut W,
_opts: InlineOpts
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + Send + Unpin,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write inlined bytes with specific options
source§impl Inlinable for RawBlock
impl Inlinable for RawBlock
fn read_optional_inlined<R: Read>(reader: &mut R) -> Result<Option<Self>>
source§fn write_inlined<W: Write>(&self, wtr: &mut W) -> Result<usize>
fn write_inlined<W: Write>(&self, wtr: &mut W) -> Result<usize>
Write inlined bytes to a writer.
source§fn write_inlined_with<W: Write>(
&self,
wtr: &mut W,
_opts: InlineOpts
) -> Result<usize>
fn write_inlined_with<W: Write>( &self, wtr: &mut W, _opts: InlineOpts ) -> Result<usize>
Write inlined bytes with specific options
source§fn printable_inlined(&self) -> String
fn printable_inlined(&self) -> String
Get inlined bytes as printable string, all the bytes will displayed with escaped ascii code.
impl Send for RawBlock
impl Sync for RawBlock
Auto Trait Implementations§
impl !Freeze for RawBlock
impl !RefUnwindSafe for RawBlock
impl Unpin for RawBlock
impl !UnwindSafe for RawBlock
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