Initial commit: Book management system with Rust Loco backend and Vue 3 frontend
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
use sea_orm::Database;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let db = Database::connect("sqlite:book-manager_development.sqlite")
|
||||
.await
|
||||
.expect("Failed to connect to database");
|
||||
|
||||
let result: Vec<serde_json::Value> = sea_orm::DatabaseConnection::query_all(
|
||||
&db,
|
||||
sea_orm::Statement::from_string(
|
||||
sea_orm::DatabaseBackend::Sqlite,
|
||||
"SELECT COUNT(*) as count FROM books".to_string(),
|
||||
),
|
||||
)
|
||||
.await
|
||||
.expect("Failed to query");
|
||||
|
||||
println!("Books count: {:?}", result);
|
||||
}
|
||||
Reference in New Issue
Block a user