Skip to content

Commit 7dd9257

Browse files
psteinroeclaude
andcommitted
fix: use column names with ! suffix in FromRow implementation
SQL files use "name!" notation for column names (literal identifiers), so FromRow must look for these exact names. Also fix clippy warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a8c551c commit 7dd9257

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

crates/pgls_splinter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub async fn run_splinter(
6262
}
6363

6464
// Check if Supabase roles exist (anon, authenticated, service_role)
65-
let has_supabase_roles = params.schema_cache.map_or(false, |cache| {
65+
let has_supabase_roles = params.schema_cache.is_some_and(|cache| {
6666
let required_roles = ["anon", "authenticated", "service_role"];
6767
required_roles.iter().all(|role_name| {
6868
cache

crates/pgls_splinter/src/query.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use serde_json::Value;
2-
use sqlx::{PgPool, Row};
2+
use sqlx::Row;
33

44
/// Raw query result from the Splinter SQL query.
55
/// This struct represents a single linting issue found in the database.
@@ -39,19 +39,20 @@ pub struct SplinterQueryResult {
3939
}
4040

4141
// Implement FromRow manually since we're using dynamic SQL
42+
// Column names include "!" suffix (e.g., "name!") which indicates NOT NULL in SQL files
4243
impl<'r> sqlx::FromRow<'r, sqlx::postgres::PgRow> for SplinterQueryResult {
4344
fn from_row(row: &'r sqlx::postgres::PgRow) -> Result<Self, sqlx::Error> {
4445
Ok(SplinterQueryResult {
45-
name: row.try_get("name")?,
46-
title: row.try_get("title")?,
47-
level: row.try_get("level")?,
48-
facing: row.try_get("facing")?,
49-
categories: row.try_get("categories")?,
50-
description: row.try_get("description")?,
51-
detail: row.try_get("detail")?,
52-
remediation: row.try_get("remediation")?,
53-
metadata: row.try_get("metadata")?,
54-
cache_key: row.try_get("cache_key")?,
46+
name: row.try_get("name!")?,
47+
title: row.try_get("title!")?,
48+
level: row.try_get("level!")?,
49+
facing: row.try_get("facing!")?,
50+
categories: row.try_get("categories!")?,
51+
description: row.try_get("description!")?,
52+
detail: row.try_get("detail!")?,
53+
remediation: row.try_get("remediation!")?,
54+
metadata: row.try_get("metadata!")?,
55+
cache_key: row.try_get("cache_key!")?,
5556
})
5657
}
5758
}

0 commit comments

Comments
 (0)