Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should be able to pass a model to update #179

Closed
sgrif opened this issue Feb 3, 2016 · 1 comment
Closed

We should be able to pass a model to update #179

sgrif opened this issue Feb 3, 2016 · 1 comment

Comments

@sgrif
Copy link
Member

sgrif commented Feb 3, 2016

I'd like to be able to write something like this:

let post = try!(posts::table.find(id).get_result::<Post>(&connection));

update(post).set(posts::published.eq(true)).execute(&connection)

post in that example should be a shorthand for posts::table.find(id). Why not just write that? Because I want this code to return Err(DatabaseError::NotFound) if the id doesn't exist. This will probably require a new trait, instead of tacking it onto an exiting one. I've been mulling over #[derive(Identifiable)] for a while, which I think will eventually be required for associations anyway.

sgrif added a commit that referenced this issue Feb 5, 2016
This adds two new missing features to `SQLite`. A `ToSql` impl for
`Bool`, and an implementation of `save_changes`. I wanted to keep the
blanket impl for `SupportsReturningKeyword`, but it looks like I can't
rely on `Sqlite` not implementing it from the user's crate. I think this
will just get moved in crate once we solve #179 anyway.

There are still some remaining things to be addressed, such as the lack
of support for numeric and date types, but those are out of scope for
0.5.

Fixes #173.
@sgrif
Copy link
Member Author

sgrif commented Dec 10, 2016

This was implemented by a737308

@sgrif sgrif closed this as completed Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant