use crate::db::sea_query_db::impl_sea_query_db_backend;
impl_sea_query_db_backend!(DatabasePostgres: sqlx::postgres::Postgres, sqlx::postgres::PgPool, PostgresRow, PostgresValueRef, sea_query::PostgresQueryBuilder);
impl DatabasePostgres {
#[expect(clippy::unused_async)]
async fn init(&self) -> crate::db::Result<()> {
Ok(())
}
fn prepare_values(values: &mut sea_query_sqlx::SqlxValues) {
for value in &mut values.0.0 {
Self::tinyint_to_smallint(value);
}
}
fn tinyint_to_smallint(value: &mut sea_query::Value) {
if let sea_query::Value::TinyInt(num) = value {
*value = sea_query::Value::SmallInt(num.map(i16::from));
}
}
fn last_inserted_row_id_for(_result: &sqlx::postgres::PgQueryResult) -> Option<u64> {
None
}
#[expect(clippy::unused_self)] pub(super) fn sea_query_column_type_for(
&self,
column_type: crate::db::ColumnType,
) -> sea_query::ColumnType {
sea_query::ColumnType::from(column_type)
}
}