Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
94 stars 13 forks source link

Small integer type #86

Open jayvdb opened 1 year ago

jayvdb commented 1 year ago

Currently SqlValRef only supports integer types Int(i32) & BigInt(i64).

And the Rust integer types are mapped to these as follows:

impl_prim_sql!(i64, BigInt, BigInt);
impl_prim_sql!(i32, Int, Int);
impl_prim_sql!(u32, BigInt, BigInt);
// TODO need a small int type
impl_prim_sql!(u16, Int, Int);
impl_prim_sql!(i16, Int, Int);
impl_prim_sql!(u8, Int, Int);
impl_prim_sql!(i8, Int, Int);

In sqlite there is only one datatype INTEGER.

OTOH, the SQL spec, and postgres has a smallint . c.f. https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT . It isnt mentioned on that webpage: smallint is signed, like int and bigint.