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

How can I use the raw sql? #1294

Closed
driftluo opened this Issue Nov 5, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@driftluo

driftluo commented Nov 5, 2017

Hi, all, I encountered a problem, the output:

error[E0425]: cannot find function `sql_query` in module `diesel`
  --> src/models/articles.rs:31:27
   |
31 |         let res = diesel::sql_query(format!("select * from article_with_tag where id={} and published={}", id, admin))
   |                           ^^^^^^^^^ not found in `diesel`

the cargo.toml:

[dependencies.diesel]
features = ["postgres", "chrono"]
version = "^0.16.0"

[dependencies.chrono]
features = ["serde"]
version = "^0.4.0"

[dependencies.diesel_codegen]
features = ["postgres"]
version = "^0.16.0"

Document said there has the sql_query method, but here is wrong, I want to know how to call the native sql operation

@killercup

This comment has been minimized.

Member

killercup commented Nov 5, 2017

@driftluo

This comment has been minimized.

driftluo commented Nov 5, 2017

Oh, thanks, However, at the moment crates' docs and readme's docs both point to the wrong address, which has a negative effect on the work

@killercup

This comment has been minimized.

Member

killercup commented Nov 5, 2017

@killercup

This comment has been minimized.

Member

killercup commented Nov 5, 2017

I opened #1295 to change the documentation links. As this issue is about how to use raw SQL, I'll close it.

Thanks again!

@killercup killercup closed this Nov 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment