We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rust-analyzer and cargo complains about the casing of a variable leading to false negatives
use sqlx::{prelude::FromRow, Connection, SqliteConnection}; const DATABASE_URL: &str = "./mydb/sqlite"; #[derive(Debug, FromRow)] #[sqlx(rename_all = "UPPERCASE")] pub struct ObjInfo { pub name: String, } pub async fn get_info(name: &str) -> Result<ObjInfo, Box<dyn std::error::Error>> { let mut conn = SqliteConnection::connect(DATABASE_URL).await?; let param = format!("{}%", name); let record = sqlx::query!("SELECT MYNAME FROM mytable WHERE MYNAME = ?", param) .fetch_one(&mut conn) .await?; Ok(ObjInfo { name: record.MYNAME.unwrap_or_default() }) }
gives the error on the query as so:
Field `MYNAME` should have snake_case name, e.g. `myname` Variable `sqlx_query_as_NAME` should have snake_case name, e.g. `sqlx_query_as_name`
sqlx = { version = "0.7.4", features = ["chrono", "macros", "runtime-tokio", "sqlite"] }
rustc --version
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Bug Description
rust-analyzer and cargo complains about the casing of a variable leading to false negatives
Minimal Reproduction
gives the error on the query as so:
Info
sqlx = { version = "0.7.4", features = ["chrono", "macros", "runtime-tokio", "sqlite"] }
rustc --version
: rustc 1.79.0 (129f3b996 2024-06-10)The text was updated successfully, but these errors were encountered: