-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Is there now (or in the future) UUID support or should I just convert to a string?
pub async fn find_by_id(ctx: &Context<'_>, id: Uuid) -> Result<Option<Organization>> {
let pool = ctx.data::<PgPool>()?;
let sql = SqlBuilder::select_from(ORGANIZATION_TABLE_NAME)
.field("*")
// Right now I need to convert to a string
.and_where("id = $1".bind(&id.to_string()))
.sql()?;
Ok(sqlx::query_as::<_, Organization>(sql.as_str())
.fetch_optional(pool)
.await?)
}Also, would you recommend using .and_where("id = $1".bind(&SqlName::new(id).safe())) to prevent sql injection since the id is passed from the client or is my understanding of SqlName incorrect?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels