mybatis_core/results/
mod.rs

1use sqlx_core::error::BoxDynError;
2
3use crate::convert::ResultCodec;
4
5/// convert sqlx-Result to mybatis-core Result
6impl<T> ResultCodec<T> for Result<T, BoxDynError> {
7    fn into_result(self) -> crate::Result<T> {
8        match self {
9            Ok(t) => {
10                return Ok(t);
11            }
12            Err(e) => {
13                return Err(crate::Error::from(e.to_string()));
14            }
15        }
16    }
17}
18
19/// convert sqlx-Result to mybatis-core Result
20impl<T> ResultCodec<T> for Result<T, sqlx_core::error::Error> {
21    fn into_result(self) -> crate::Result<T> {
22        match self {
23            Ok(t) => {
24                return Ok(t);
25            }
26            Err(e) => {
27                return Err(crate::Error::from(e.to_string()));
28            }
29        }
30    }
31}
32
33/// convert sqlx-Result to mybatis-core Result
34impl<T> ResultCodec<T> for Result<T, serde_json::Error> {
35    fn into_result(self) -> crate::Result<T> {
36        match self {
37            Ok(t) => {
38                return Ok(t);
39            }
40            Err(e) => {
41                return Err(crate::Error::from(e.to_string()));
42            }
43        }
44    }
45}