移除无用代码

This commit is contained in:
liyunjia 2024-06-16 21:17:45 +08:00
parent 6ff83b20df
commit 3420c085e0

View File

@ -25,32 +25,6 @@ impl Display for Role {
}
}
// impl sqlx::Type<sqlx::Postgres> for Role {
// fn type_info() -> sqlx::postgres::PgTypeInfo {
// sqlx::postgres::PgTypeInfo::with_name("CHAR(1)")
// }
// }
// impl<'r> sqlx::Decode<'r, sqlx::Postgres> for Role {
// fn decode(value: sqlx::postgres::PgValueRef<'r>) -> Result<Self, sqlx::error::BoxDynError> {
// match value.as_str().map_err(|_| sqlx::Error::Decode("Invalid Role".into()))? {
// "admin" => Ok(Role::Admin),
// "user" => Ok(Role::User),
// _ => Err(sqlx::Error::Decode("Unknown Role".into()))?,
// }
// }
// }
// impl sqlx::Encode<'_, sqlx::Postgres> for Role {
// fn encode_by_ref(&self, buf: &mut sqlx::postgres::PgArgumentBuffer) -> sqlx::encode::IsNull {
// match self {
// Role::Admin => buf.extend_from_slice(b"admin"),
// Role::User => buf.extend_from_slice(b"user"),
// }
// sqlx::encode::IsNull::No
// }
// }
impl Into<Role> for String {
fn into(self) -> Role {
match self.as_str() {