Trait taos_query::prelude::AsyncQueryable
source · pub trait AsyncQueryable: Send + Sync + Sized {
type AsyncResultSet: AsyncFetchable;
Show 23 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> { ... }
fn table_vgroup_id<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_db: &'life1 str,
_table: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<i32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn tables_vgroup_ids<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
_db: &'life1 str,
_tables: &'life2 [T],
) -> Pin<Box<dyn Future<Output = Option<Vec<i32>>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<str> + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}
Expand description
The synchronous query trait for TDengine connection.
Required Associated Types§
Required Methods§
fn query<'life0, 'async_trait, T>( &'life0 self, sql: T, ) -> Pin<Box<dyn Future<Output = RawResult<Self::AsyncResultSet>> + Send + '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>>
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>>
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>>
fn exec_many<'life0, 'async_trait, T, I>( &'life0 self, input: I, ) -> Pin<Box<dyn Future<Output = RawResult<usize>> + Send + 'async_trait>>
sourcefn query_one<'life0, 'async_trait, T, O>(
&'life0 self,
sql: T,
) -> Pin<Box<dyn Future<Output = RawResult<Option<O>>> + Send + '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>>
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();
sourcefn 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 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.
sourcefn create_database<'life0, 'async_trait, N>(
&'life0 self,
name: N,
) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
fn create_database<'life0, 'async_trait, N>( &'life0 self, name: N, ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
Short for CREATE DATABASE IF NOT EXISTS {name}
.
sourcefn use_database<'life0, 'async_trait, N>(
&'life0 self,
name: N,
) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
fn use_database<'life0, 'async_trait, N>( &'life0 self, name: N, ) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + 'async_trait>>
Short for USE {name}
.
sourcefn create_topic<'life0, 'async_trait, N, S>(
&'life0 self,
name: N,
sql: S,
) -> Pin<Box<dyn Future<Output = RawResult<()>> + Send + '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>>
Short for CREATE TOPIC IF NOT EXISTS {name} AS {sql}
.
sourcefn 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 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}
.
sourcefn 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 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
.
sourcefn 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 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.
sourcefn 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 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.
sourcefn 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 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
sourcefn exec_sync<T: AsRef<str> + Send + Sync>(&self, sql: T) -> RawResult<usize>
fn exec_sync<T: AsRef<str> + Send + Sync>(&self, sql: T) -> RawResult<usize>
Sync version of exec
.
sourcefn query_sync<T: AsRef<str> + Send + Sync>(
&self,
sql: T,
) -> RawResult<Self::AsyncResultSet>
fn query_sync<T: AsRef<str> + Send + Sync>( &self, sql: T, ) -> RawResult<Self::AsyncResultSet>
Sync version of query
.
fn table_vgroup_id<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_db: &'life1 str,
_table: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<i32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn tables_vgroup_ids<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, _db: &'life1 str, _tables: &'life2 [T], ) -> Pin<Box<dyn Future<Output = Option<Vec<i32>>> + Send + 'async_trait>>
Object Safety§
This trait is not object safe.