pub struct Taos { /* private fields */ }
Implementations§
source§impl Taos
impl Taos
pub fn new<'a>(
ip: impl Into<NullableCStr<'a>>,
user: impl Into<NullableCStr<'a>>,
pass: impl Into<NullableCStr<'a>>,
db: impl Into<NullableCStr<'a>>,
port: u16
) -> Result<Self, Error>
pub async fn create_table(
&self,
table: &str,
options: Option<&str>
) -> Result<(), Error>
pub async fn create_table_if_not_exists(
&self,
table: &str,
options: Option<&str>
) -> Result<(), Error>
pub async fn create_database(&self, database: &str) -> Result<(), Error>
pub async fn create_database_if_exists(
&self,
database: &str
) -> Result<(), Error>
pub async fn use_database(&self, database: &str) -> Result<(), Error>
pub async fn describe(&self, table: &str) -> Result<TaosDescribe, Error>
pub async fn exec(&self, sql: impl ToCString) -> Result<(), Error>
pub fn raw_query(&self, s: impl ToCString) -> Result<CTaosResult, Error>
pub async fn query(&self, s: &str) -> Result<TaosQueryData, Error>
sourcepub fn load_table_info(&self, cstr: impl AsRef<CStr>) -> Result<(), Error>
pub fn load_table_info(&self, cstr: impl AsRef<CStr>) -> Result<(), Error>
Warmup table metadata cache with a list of table name, separated by comma.
ⓘ
let tables = CString::new("table1,table2");
taos.load_table_info(&tables).unwrap();
pub fn as_raw(&self) -> *mut TAOS
source§impl Taos
impl Taos
sourcepub fn schemaless_insert(
&self,
lines: &[impl ToCString],
protocol: TSDB_SML_PROTOCOL_TYPE,
precision: TSDB_SML_TIMESTAMP_TYPE
) -> Result<i32, TaosError>
pub fn schemaless_insert(
&self,
lines: &[impl ToCString],
protocol: TSDB_SML_PROTOCOL_TYPE,
precision: TSDB_SML_TIMESTAMP_TYPE
) -> Result<i32, TaosError>
Schemaless insert with different protocol and timestamp precision.
-
InfluxDB line protocol
ⓘlet lines = ["st,t1=abc,t2=def,t3=anything c1=3i64,c3=L\"pass\",c2=false,c4=4f64 1626006833639000000"]; taos.schemaless_insert(&lines, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_NANOSECONDS)?;
-
OpenTSDB telnet protocol
ⓘlet lines = ["sys.if.bytes.out 1479496100 1.3E3 host=web01 interface=eth0"]; taos.schemaless_insert(&lines, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED)?;
-
or OpenTSDB json protocol.
ⓘlet lines = [r#" { "metric": "st", "timestamp": 1626006833, "value": 10, "tags": { "t1": true, "t2": false, "t3": 10, "t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>" } }"#]; taos.schemaless_insert(&lines, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED)?;