0
点赞
收藏
分享

微信扫一扫

数字人的未来:数字人对话系统 Linly-Talker + 克隆语音 GPT-SoVITS

爱上流星雨 2024-02-26 阅读 9

引入crate:

postgres = "0.19.7"
use postgres::{Client, NoTls, error::Error};

fn main() -> Result<(), Error> {
    let mut client = Client::connect("host=localhost port=5432 dbname=xxxxdb user=postgres password=xxxxxx", NoTls).unwrap();
    for row in client.query("select * from xxxx", &[])?{
        let id: i32 = row.get(0);
        let name: &str = row.get(1);
        let file_name: &str = row.get(2);
        //let create_time: std::time = row.get(3);
        let valid: bool = row.get(4);
        println!("id:{}, name:{}, file_name:{}, valid:{}", id, name, file_name, valid);
    }
    Ok(())
}

注意:用户名不要使用root。否则报错:

thread 'main' panicked at src\main.rs:5:115:
called `Result::unwrap()` on an `Err` value: Error { kind: Parse, cause: Some(Custom { kind: InvalidInput, error: Utf8Error { valid_up_to: 0, error_len: Some(1) } }) }

举报

相关推荐

0 条评论