Trait taos::AsyncQueryable

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

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

source

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

source

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

source

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

source

fn write_raw_block<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Provided Methods§

source

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

source

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

source

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

source

fn query_one<'life0, 'async_trait, T, O>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = Result<Option<O>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait + AsRef<str> + Send + Sync, O: 'async_trait + DeserializeOwned + Send, Self: '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 = Result<Cow<'life0, str>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, N: 'async_trait + AsRef<str> + Send, Self: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, N: 'async_trait + AsRef<str> + Send, Self: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, N: 'async_trait + AsRef<str> + Send + Sync, S: 'async_trait + AsRef<str> + Send, Self: '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 AsRef<str> + Send + Sync + 'async_trait, db: impl Display + Send + 'async_trait ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: '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 = Result<Vec<ShowDatabase>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Short for SHOW DATABASES.

source

fn topics<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<Topic>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: '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 = Result<Describe, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get table meta information.

source

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

Check if database exists

source

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

Sync version of exec.

source

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

Sync version of query.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AsyncQueryable for Taos

§

type AsyncResultSet = ResultSet

source§

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

source§

fn query_with_req_id<'life0, 'async_trait, T>( &'life0 self, _sql: T, _req_id: u64 ) -> Pin<Box<dyn Future<Output = Result<<Taos as AsyncQueryable>::AsyncResultSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait + AsRef<str> + Send + Sync, Taos: 'async_trait,

source§

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

source§

fn write_raw_block<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: 'async_trait,

source§

fn put<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 SmlData ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: 'async_trait,

source§

impl AsyncQueryable for WsTaos

§

type AsyncResultSet = ResultSet

source§

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

source§

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

source§

fn write_raw_meta<'life0, 'life1, 'async_trait>( &'life0 self, raw: &'life1 RawMeta ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, WsTaos: 'async_trait,

source§

fn write_raw_block<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, WsTaos: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, WsTaos: 'async_trait,

source§

fn put<'life0, 'life1, 'async_trait>( &'life0 self, _data: &'life1 SmlData ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, WsTaos: 'async_trait,

source§

impl AsyncQueryable for Taos

§

type AsyncResultSet = ResultSet

source§

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

source§

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

source§

fn write_raw_meta<'life0, 'life1, 'async_trait>( &'life0 self, raw: &'life1 RawMeta ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: 'async_trait,

source§

fn write_raw_block<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 RawBlock ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: '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 = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: 'async_trait,

source§

fn put<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 SmlData ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Taos: 'async_trait,

Implementors§