Skip to content

Commit

Permalink
Add various blob column types with size
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Jul 8, 2022
1 parent b0ea113 commit 711ff2f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/entity/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ pub enum ColumnType {
Date,
/// `BINARY` data types contain byte strings—a sequence of octets or bytes.
Binary,
/// Tiny Binary
TinyBinary,
/// Medium Binary
MediumBinary,
/// Long Binary
LongBinary,
/// `BOOLEAN` is the result of a comparison operator
Boolean,
/// `MONEY` data type handles monetary data
Expand Down Expand Up @@ -383,6 +389,9 @@ impl From<ColumnType> for sea_query::ColumnType {
ColumnType::Time => sea_query::ColumnType::Time(None),
ColumnType::Date => sea_query::ColumnType::Date,
ColumnType::Binary => sea_query::ColumnType::Binary(sea_query::BlobSize::Blob(None)),
ColumnType::TinyBinary => sea_query::ColumnType::Binary(sea_query::BlobSize::Tiny),
ColumnType::MediumBinary => sea_query::ColumnType::Binary(sea_query::BlobSize::Medium),
ColumnType::LongBinary => sea_query::ColumnType::Binary(sea_query::BlobSize::Long),
ColumnType::Boolean => sea_query::ColumnType::Boolean,
ColumnType::Money(s) => sea_query::ColumnType::Money(s),
ColumnType::Json => sea_query::ColumnType::Json,
Expand Down Expand Up @@ -419,7 +428,10 @@ impl From<sea_query::ColumnType> for ColumnType {
sea_query::ColumnType::TimestampWithTimeZone(_) => Self::TimestampWithTimeZone,
sea_query::ColumnType::Time(_) => Self::Time,
sea_query::ColumnType::Date => Self::Date,
sea_query::ColumnType::Binary(_) => Self::Binary,
sea_query::ColumnType::Binary(sea_query::BlobSize::Blob(_)) => Self::Binary,
sea_query::ColumnType::Binary(sea_query::BlobSize::Tiny) => Self::TinyBinary,
sea_query::ColumnType::Binary(sea_query::BlobSize::Medium) => Self::MediumBinary,
sea_query::ColumnType::Binary(sea_query::BlobSize::Long) => Self::LongBinary,
sea_query::ColumnType::Boolean => Self::Boolean,
sea_query::ColumnType::Money(s) => Self::Money(s),
sea_query::ColumnType::Json => Self::Json,
Expand Down

0 comments on commit 711ff2f

Please sign in to comment.