diff --git a/src/types/to_sql.rs b/src/types/to_sql.rs index d6b3daf..3738217 100644 --- a/src/types/to_sql.rs +++ b/src/types/to_sql.rs @@ -57,8 +57,13 @@ macro_rules! to_sql_self( to_sql_self!(Null); to_sql_self!(bool); +to_sql_self!(i8); +to_sql_self!(i16); to_sql_self!(i32); to_sql_self!(i64); +to_sql_self!(u8); +to_sql_self!(u16); +to_sql_self!(u32); to_sql_self!(f64); impl<'a, T: ?Sized> ToSql for &'a T @@ -95,3 +100,21 @@ impl ToSql for Option { } } } + +#[cfg(test)] +mod test { + use super::ToSql; + + fn is_to_sql() {} + + #[test] + fn test_integral_types() { + is_to_sql::(); + is_to_sql::(); + is_to_sql::(); + is_to_sql::(); + is_to_sql::(); + is_to_sql::(); + is_to_sql::(); + } +} diff --git a/src/types/value.rs b/src/types/value.rs index 3628546..e192826 100644 --- a/src/types/value.rs +++ b/src/types/value.rs @@ -30,11 +30,22 @@ impl From for Value { } } -impl From for Value { - fn from(i: i32) -> Value { - Value::Integer(i as i64) - } -} +macro_rules! from_i64( + ($t:ty) => ( + impl From<$t> for Value { + fn from(i: $t) -> Value { + Value::Integer(i as i64) + } + } + ) +); + +from_i64!(i8); +from_i64!(i16); +from_i64!(i32); +from_i64!(u8); +from_i64!(u16); +from_i64!(u32); impl From for Value { fn from(i: i64) -> Value {