all-things-risingwave

Does RisingWave support sqlx or other static check tool?

I am looking for a tool that supports static checking RisingWave SQL, similar to sqlx for Postgres.

Yu

Yu Ting

Asked on Dec 16, 2023

  • RisingWave SQL is compatible with Postgres, and you can use sqlx for static checking.
  • Most RisingWave SQL is compatible with PostgreSQL, so sqlx can be used for static checking.
  • Here is an example of using sqlx for static checking:
use sqlx::query;

#[derive(sqlx::FromRow)]
struct User {
    id: i32,
    name: String,
}

async fn get_users() -> Result<Vec<User>, sqlx::Error> {
    let users = query!("SELECT * FROM users").fetch_all(&mut conn).await?;
    Ok(users)
}
Dec 16, 2023Edited by