Giter VIP home page Giter VIP logo

old-rustorm's Introduction

Rustorm

A big Rewrite is on-going

Latest Version Build Status Downloads Coverage Status Build status MIT licensed

An ORM for rust

Design

Rustorm is design to get data from dynamic tables, i.e tables that are created at run-time.

Features

  • Fluent high-level and low-level API
  • Composable queries
  • Automatic renames of conflicted colum names in the query.
  • Easy to reason out generated SQL

Suppported database

  • Postgresql
  • Sqlite
  • Mysql

Roadmap

  • Support for Mysql

For Updates

Follow me on twitter: @ivanceras

Related project

old-rustorm's People

Contributors

chamakits avatar contradictioned avatar gitter-badger avatar ivanceras avatar kaj avatar kyeah avatar mtorromeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

old-rustorm's Issues

Platform should be Clonable

Hi, as i wrote in the title, Platform should be Clonable if we want to use it with threads like the following example:

pub fn start(&self) -> bool {
    let address = self.hostname.to_string() + ":" + &self.port.to_string();
    let listener = TcpListener::bind(&*address).unwrap();
    let url = "mysql://root:root@localhost/database";
    let pool = ManagedPool::init(&url, 1).unwrap();
    let db = pool.connect().unwrap();

    for stream in listener.incoming() {
        match stream {
            Ok(mut stream) => {
                thread::spawn(move|| {
                    handle_client(db, &mut stream);
                });
            },
            Err(e) => {
                println!("{}", e);
                return false;
            }
        }
    }
}

Error:

error: capture of moved value: `db` [E0382]
help: perhaps you meant to use `clone()`?

I wanted to create a pull request but to do that, we have to create a pull request for r2d2 also (i guess)

What is `dao.get_opt()`? Is README outdated?

I tried to write tiny code but compilation was failed:

src/sozai/mod.rs:46:26: 46:48 error: mismatched types:
 expected `uuid::Uuid`,
    found `core::option::Option<&rustorm::dao::Value>`
(expected struct `uuid::Uuid`,
    found enum `core::option::Option`) [E0308]
src/sozai/mod.rs:46             resource_id: dao.get("resource_id"),
                                             ^~~~~~~~~~~~~~~~~~~~~~

dao::Dao is defined as BTreeMap<String, Value>, so Dao::get() returns Option and Dao::get_opt doesn't seem available.

How to use these methods?
Are these examples wrong?

`cargo test --features sqlite` does not compile

I cloned the repository and ran:

cargo test --features sqlite

and the following results were printed to stderr:

/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78:5: 78:88 warning: the trait `core::marker::Sized` is not implemented for the type `Self` [E0277]
/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78     unsafe fn column_result(stmt: *mut sqlite3_stmt, col: c_int) -> SqliteResult<Self>;
                                                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78:5: 78:88 help: run `rustc --explain E0277` to see a detailed explanation
/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78:5: 78:88 note: `Self` does not have a constant size known at compile-time
/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78:5: 78:88 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78     unsafe fn column_result(stmt: *mut sqlite3_stmt, col: c_int) -> SqliteResult<Self>;
                                                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kcollins/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/rusqlite-0.3.1/src/types.rs:78:5: 78:88 note: required by `core::result::Result`
src/platform/sqlite.rs:47:27: 47:32 error: mismatched types:
 expected `&rusqlite::SqliteConnection`,
    found `&&r2d2::PooledConnection<r2d2_sqlite::SqliteConnectionManager>`
(expected struct `rusqlite::SqliteConnection`,
    found &-ptr) [E0308]
src/platform/sqlite.rs:47             Some(conn) => &conn,
                                                    ^~~~~
src/platform/sqlite.rs:47:27: 47:32 help: run `rustc --explain E0308` to see a detailed explanation
src/platform/sqlite.rs:57:23: 57:34 error: no associated item named `Null` found for type `dao::Value` in the current scope
src/platform/sqlite.rs:57             Err(_) => Value::Null,
                                                ^~~~~~~~~~~
src/platform/sqlite.rs:47:27: 47:32 error: mismatched types:
 expected `&rusqlite::SqliteConnection`,
    found `&&r2d2::PooledConnection<r2d2_sqlite::SqliteConnectionManager>`
(expected struct `rusqlite::SqliteConnection`,
    found &-ptr) [E0308]
src/platform/sqlite.rs:47             Some(conn) => &conn,
                                                    ^~~~~
src/platform/sqlite.rs:47:27: 47:32 help: run `rustc --explain E0308` to see a detailed explanation
src/platform/sqlite.rs:57:23: 57:34 error: no associated item named `Null` found for type `dao::Value` in the current scope
src/platform/sqlite.rs:57             Err(_) => Value::Null,
                                                ^~~~~~~~~~~
<std macros>:6:1: 6:32 error: the trait `core::convert::From<rusqlite::SqliteError>` is not implemented for the type `database::DbError` [E0277]
<std macros>:6 $ crate:: convert:: From:: from ( err ) ) } } )
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pool.rs:94:39: 94:91 note: in this expansion of try! (defined in <std macros>)
<std macros>:6:1: 6:32 help: run `rustc --explain E0277` to see a detailed explanation
<std macros>:6:1: 6:32 note: required by `core::convert::From::from`
error: aborting due to 3 previous errors
<std macros>:6:1: 6:32 error: the trait `core::convert::From<rusqlite::SqliteError>` is not implemented for the type `database::DbError` [E0277]
<std macros>:6 $ crate:: convert:: From:: from ( err ) ) } } )
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pool.rs:94:39: 94:91 note: in this expansion of try! (defined in <std macros>)
<std macros>:6:1: 6:32 help: run `rustc --explain E0277` to see a detailed explanation
<std macros>:6:1: 6:32 note: required by `core::convert::From::from`
error: aborting due to 3 previous errors
Could not compile `rustorm`.

To learn more, run the command again with --verbose.

Is rustorm dead?

Im considering using pg for our backend db and noticed a few orm, one of which is rustorm. There have been no updates for the package and dont know if its dead, or what. Are there any updates in regards of the state of the project?

Strings from database surrounded with \' on either side

I'm using rustorm with mysql. I've got a table of states (filled with info on the fifty United States) with a column of abbreviations. I select all abbreviations this way:

let abbreviations = Query::select().from_table("state").column("abbreviation").retrieve(db.as_ref()).unwrap()

Then map them to a list of strings this way:

let abbreviations: Vec<String> = abbreviations.dao.iter().map(|dao| dao.get::<String>("abbreviation")).collect()

When i println abbreviations, I get:

["\'AK\'", "\'AL\'", "\'AS\'", "\'AZ\'", "\'AR\'", "\'CA\'", "\'CO\'", "\'CT\'", "\'DE\'", "\'FL\'", "\'GA\'", "\'HI\'", "\'ID\'", "\'IL\'", "\'IN\'", "\'IA\'", "\'KS\'", "\'KY\'", "\'LA\'", "\'ME\'", "\'MD\'", "\'MA\'", "\'MI\'", "\'MN\'", "\'MS\'", "\'MO\'", "\'MT\'", "\'NE\'", "\'NV\'", "\'NH\'", "\'NJ\'", "\'NM\'", "\'NY\'", "\'NC\'", "\'ND\'", "\'OH\'", "\'OK\'", "\'OR\'", "\'PA\'", "\'RI\'", "\'SC\'", "\'SD\'", "\'TN\'", "\'TX\'", "\'UT\'", "\'VT\'", "\'VA\'", "\'WA\'", "\'WV\'", "\'WI\'", "\'WY\'"]

When I believe I should be getting just

["AK", "AL" ...]

Am I doing something incorrectly or is the library?

latest status?

When I look in to diesel for using, I find that it is not as good as people expect. In my option, rustorm is better in usage (at lease now.)

So, I want to ask the status of rustorm now, and the plan of it in the future?

thx.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.