https://stackoverflow.com/a/72726156/10810540
use chrono::{DateTime, Utc};
#[derive(Deserialize, Serialize, Debug, sqlx::FromRow)]
struct ChatHistory {
id: i64,
idol_id: i32,
msg_id: String,
ref_msg_id: String,
role: String,
address: String,
content: String,
create_time: DateTime<Utc>,
update_time: DateTime<Utc>,
}
在Cargo.toml中加入 time
和 chrono
的特性
sqlx = { version = "0.6.0", features = [ "postgres", "runtime-tokio-native-tls", "offline", "time", "chrono" ] }