learn_orm_word/src/main.rs
2024-07-20 00:17:57 +08:00

25 lines
627 B
Rust

use std::error::Error;
use sea_orm::{ ActiveModelTrait, ActiveValue};
use start_db::Starter;
// use serde_json::json;
use tokio;
pub mod word_entity;
pub mod start_db;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let db_info = Starter::connect().await?;
// db_info.create_table().await?;
let insert_word = word_entity::ActiveModel{
id:ActiveValue::not_set(),
bsm: ActiveValue::set("test".to_string()),
hz: ActiveValue::set("test".to_string()),
py_js: ActiveValue::set("test".to_string()),
};
insert_word.insert(&db_info.db).await?;
Ok(())
}