Rust 的 ORM 框架:rustorm

pdce 9年前

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
    </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);          }      }  }

    项目主页:http://www.open-open.com/lib/view/home/1434010377020