connect.rs 483 字节
Newer Older
B
Bo Ding 已提交
1 2 3 4
use libtaos::*;

fn taos_connect() -> Result<Taos, Error> {
    TaosCfgBuilder::default()
5
        .ip("localhost")
B
Bo Ding 已提交
6 7
        .user("root")
        .pass("taosdata")
8
        // .db("log") // remove comment if you want to connect to database log by default.
B
Bo Ding 已提交
9 10
        .port(6030u16)
        .build()
11
        .expect("TaosCfg builder error")
B
Bo Ding 已提交
12 13 14 15 16
        .connect()
}

fn main() {
    #[allow(unused_variables)]
B
Bo Ding 已提交
17
    let taos = taos_connect().expect("connect error");
B
Bo Ding 已提交
18 19
    println!("Connected")
}