Skip to content

Commit

Permalink
fix: Rewrite the transformer.
Browse files Browse the repository at this point in the history
  • Loading branch information
langyo committed Oct 27, 2023
1 parent 25662ea commit a1693cf
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/database/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,19 @@ impl From<ExecResult> for ProxyExecResult {
fn from(result: ExecResult) -> Self {
match result.result {
#[cfg(feature = "sqlx-mysql")]
ExecResultHolder::SqlxMySql(result) => Self {
last_insert_id: result.last_insert_id(),
rows_affected: result.rows_affected(),
},
ExecResultHolder::SqlxMySql(result) => {
ProxyExecResult::Inserted(vec![ProxyExecResultIdType::Integer(
result.last_insert_id().unwrap_or(0),
)])
}
#[cfg(feature = "sqlx-postgres")]
ExecResultHolder::SqlxPostgres(result) => Self {
last_insert_id: ProxyExecResult::Empty,
rows_affected: result.rows_affected(),
},
ExecResultHolder::SqlxPostgres(result) => ProxyExecResult::Inserted(vec![]),
#[cfg(feature = "sqlx-sqlite")]
ExecResultHolder::SqlxSqlite(result) => Self {
last_insert_id: result.last_insert_id(),
rows_affected: result.rows_affected(),
},
ExecResultHolder::SqlxSqlite(result) => {
ProxyExecResult::Inserted(vec![ProxyExecResultIdType::Integer(
result.last_insert_rowid() as u64,
)])
}
#[cfg(feature = "mock")]
ExecResultHolder::Mock(result) => {
ProxyExecResult::Inserted(vec![ProxyExecResultIdType::Integer(
Expand Down

0 comments on commit a1693cf

Please sign in to comment.