Rust 的 ORM 框架:rustorm
rustorm 是 Rust 語言的一個 ORM 框架,該框架目前只支持 PostgreSQL 數據庫,還在進一步開發中。
Features
- intelligent model code generation (The only functional part for now)
- Can figure out linker tables, then build 1:M relation with the tables on the generated code
- Can figure out extension tables, which is just 1:1 relation with another table </ul> </li> </ul>
///generate_model_code.rs
extern crate rustorm;
use rustorm::db::postgres::Postgres; use rustorm::codegen; use rustorm::codegen::Config;
fn main(){ let pg:Result<Postgres,&str> = Postgres::new("postgres://postgres:p0stgr3s@localhost/bazaar_v6"); match pg{ Ok(pg) => { let config = Config{ base_module:Some("gen".to_string()), include_table_references:true, use_condensed_name:true, generate_table_meta:true, base_dir:"./examples".to_string(), }; codegen::generate_all(&pg, &config); } Err(error) =>{ println!("{}",error); } } }</pre>