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§
fn query<'life0, 'async_trait, T>( &'life0 self, sql: T ) -> Pin<Box<dyn Future<Output = Result<Self::AsyncResultSet, Error>> + Send + '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>>
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>>
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>>
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,
sourcefn query_one<'life0, 'async_trait, T, O>(
&'life0 self,
sql: T
) -> Pin<Box<dyn Future<Output = Result<Option<O>, Error>> + Send + '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>>
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 = Result<Cow<'life0, str>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
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,
Short for SELECT server_version()
as String.
sourcefn create_database<'life0, 'async_trait, N>(
&'life0 self,
name: N
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
fn create_database<'life0, 'async_trait, N>( &'life0 self, name: N ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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 = Result<(), Error>> + Send + 'async_trait>>
fn use_database<'life0, 'async_trait, N>( &'life0 self, name: N ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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 = Result<(), Error>> + Send + '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>>
Short for CREATE TOPIC IF NOT EXISTS {name} AS {sql}
.
sourcefn 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 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}
.
sourcefn 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 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
.
sourcefn 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 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.
sourcefn 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 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.
sourcefn 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 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
sourcefn query_sync<T>(&self, sql: T) -> Result<Self::AsyncResultSet, Error>
fn query_sync<T>(&self, sql: T) -> Result<Self::AsyncResultSet, Error>
Sync version of query
.
Object Safety§
This trait is not object safe.