Trait taos_query::prelude::AsyncQueryable

source ·
pub trait AsyncQueryable: Send + Sync + Sized {
    type AsyncResultSet: AsyncFetchable;

Show 21 methods // Required methods fn query<'life0, 'async_trait, T>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = RawResult<Self::AsyncResultSet>> + Send + 'async_trait>> where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait; fn put<'life0, 'life1, 'async_trait>( &'life0 self, schemaless_data: &'life1 SmlData ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn query_with_req_id<'life0, 'async_trait, T>( &'life0 self, sql: T, req_id: u64 ) -> Pin<Box<dyn Future<Output = RawResult<Self::AsyncResultSet>> + Send + 'async_trait>> where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait; fn write_raw_meta<'life0, 'life1, 'async_trait>( &'life0 self, meta: &'life1 RawMeta ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn write_raw_block<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn write_raw_block_with_req_id<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock, req_id: u64 ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn exec<'life0, 'async_trait, T>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>> where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait { ... } fn exec_with_req_id<'life0, 'async_trait, T>( &'life0 self, sql: T, req_id: u64 ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>> where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait { ... } fn exec_many<'life0, 'async_trait, T, I>( &'life0 self, input: I ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>> where T: AsRef<str> + Send + Sync + 'async_trait, I::IntoIter: Send, I: IntoIterator<Item = T> + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait { ... } fn query_one<'life0, 'async_trait, T, O>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = RawResult<Option<O>>> + Send + 'async_trait>> where T: 'async_trait + AsRef<str> + Send + Sync, O: 'async_trait + DeserializeOwned + Send, Self: 'async_trait, 'life0: 'async_trait { ... } fn server_version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RawResult<Cow<'_, str>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn create_database<'life0, 'async_trait, N>( &'life0 self, name: N ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where N: 'async_trait + AsRef<str> + Send, Self: 'async_trait, 'life0: 'async_trait { ... } fn use_database<'life0, 'async_trait, N>( &'life0 self, name: N ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where N: 'async_trait + AsRef<str> + Send, Self: 'async_trait, 'life0: 'async_trait { ... } fn create_topic<'life0, 'async_trait, N, S>( &'life0 self, name: N, sql: S ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where N: 'async_trait + AsRef<str> + Send + Sync, S: 'async_trait + AsRef<str> + Send, Self: 'async_trait, 'life0: 'async_trait { ... } fn create_topic_as_database<'life0, 'async_trait>( &'life0 self, name: impl 'async_trait + AsRef<str> + Send + Sync, db: impl 'async_trait + Display + Send ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn databases<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RawResult<Vec<ShowDatabase>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn topics<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RawResult<Vec<Topic>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn describe<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str ) -> Pin<Box<dyn Future<Output = RawResult<Describe>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn database_exists<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str ) -> Pin<Box<dyn Future<Output = RawResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn exec_sync<T: AsRef<str> + Send + Sync>(&self, sql: T) -> RawResult<usize> { ... } fn query_sync<T: AsRef<str> + Send + Sync>( &self, sql: T ) -> RawResult<Self::AsyncResultSet> { ... }
}
Expand description

The synchronous query trait for TDengine connection.

Required Associated Types§

Required Methods§

source

fn query<'life0, 'async_trait, T>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = RawResult<Self::AsyncResultSet>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

source

fn put<'life0, 'life1, 'async_trait>( &'life0 self, schemaless_data: &'life1 SmlData ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn query_with_req_id<'life0, 'async_trait, T>( &'life0 self, sql: T, req_id: u64 ) -> Pin<Box<dyn Future<Output = RawResult<Self::AsyncResultSet>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

source

fn write_raw_meta<'life0, 'life1, 'async_trait>( &'life0 self, meta: &'life1 RawMeta ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn write_raw_block<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn write_raw_block_with_req_id<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock, req_id: u64 ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

source

fn exec<'life0, 'async_trait, T>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

source

fn exec_with_req_id<'life0, 'async_trait, T>( &'life0 self, sql: T, req_id: u64 ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<str> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

source

fn exec_many<'life0, 'async_trait, T, I>( &'life0 self, input: I ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>>
where T: AsRef<str> + Send + Sync + 'async_trait, I::IntoIter: Send, I: IntoIterator<Item = T> + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

source

fn query_one<'life0, 'async_trait, T, O>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = RawResult<Option<O>>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<str> + Send + Sync, O: 'async_trait + DeserializeOwned + Send, Self: 'async_trait, 'life0: 'async_trait,

To conveniently get first row of the result, useful for queries like

  • select count(*) from ...
  • select last(*) from ...

Type T could be Vec<Value>, a tuple, or a struct with serde support.

§Example
let count: u32 = taos.query_one("select count(*) from table1")?.unwrap_or(0);

let one: (i32, String, Timestamp) =
   taos.query_one("select c1,c2,c3 from table1 limit 1")?.unwrap_or_default();
source

fn server_version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RawResult<Cow<'_, str>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Short for SELECT server_version() as String.

source

fn create_database<'life0, 'async_trait, N>( &'life0 self, name: N ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where N: 'async_trait + AsRef<str> + Send, Self: 'async_trait, 'life0: 'async_trait,

Short for CREATE DATABASE IF NOT EXISTS {name}.

source

fn use_database<'life0, 'async_trait, N>( &'life0 self, name: N ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where N: 'async_trait + AsRef<str> + Send, Self: 'async_trait, 'life0: 'async_trait,

Short for USE {name}.

source

fn create_topic<'life0, 'async_trait, N, S>( &'life0 self, name: N, sql: S ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where N: 'async_trait + AsRef<str> + Send + Sync, S: 'async_trait + AsRef<str> + Send, Self: 'async_trait, 'life0: 'async_trait,

Short for CREATE TOPIC IF NOT EXISTS {name} AS {sql}.

source

fn create_topic_as_database<'life0, 'async_trait>( &'life0 self, name: impl 'async_trait + AsRef<str> + Send + Sync, db: impl 'async_trait + Display + Send ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Short for CREATE TOPIC IF NOT EXISTS {name} WITH META AS DATABASE {db}.

source

fn databases<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RawResult<Vec<ShowDatabase>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Short for SHOW DATABASES.

source

fn topics<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RawResult<Vec<Topic>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Topics information by SELECT * FROM information_schema.ins_topics sql.

§Compatibility

This is a 3.x-only API.

source

fn describe<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str ) -> Pin<Box<dyn Future<Output = RawResult<Describe>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get table meta information.

source

fn database_exists<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str ) -> Pin<Box<dyn Future<Output = RawResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if database exists

source

fn exec_sync<T: AsRef<str> + Send + Sync>(&self, sql: T) -> RawResult<usize>

Sync version of exec.

source

fn query_sync<T: AsRef<str> + Send + Sync>( &self, sql: T ) -> RawResult<Self::AsyncResultSet>

Sync version of query.

Object Safety§

This trait is not object safe.

Implementors§