Rust 的 ORM 框架:rustorm

pdce 9年前發布 | 18K 次閱讀 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>

      項目主頁:http://www.baiduhome.net/lib/view/home/1434010377020

 本文由用戶 pdce 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!