cargo fmt
This commit is contained in:
parent
b566ea6e12
commit
f6672137a2
@ -128,7 +128,9 @@ impl Column {
|
||||
}
|
||||
ColumnType::Time(_) => quote! { ColumnType::Time.def() },
|
||||
ColumnType::Date => quote! { ColumnType::Date.def() },
|
||||
ColumnType::Binary(BlobSize::Blob(_)) | ColumnType::VarBinary(_) => quote! { ColumnType::Binary.def() },
|
||||
ColumnType::Binary(BlobSize::Blob(_)) | ColumnType::VarBinary(_) => {
|
||||
quote! { ColumnType::Binary.def() }
|
||||
}
|
||||
ColumnType::Binary(BlobSize::Tiny) => quote! { ColumnType::TinyBinary.def() },
|
||||
ColumnType::Binary(BlobSize::Medium) => quote! { ColumnType::MediumBinary.def() },
|
||||
ColumnType::Binary(BlobSize::Long) => quote! { ColumnType::LongBinary.def() },
|
||||
@ -466,14 +468,20 @@ mod tests {
|
||||
#[test]
|
||||
fn test_get_info() {
|
||||
let column: Column = ColumnDef::new(Alias::new("id")).string().to_owned().into();
|
||||
assert_eq!(column.get_info(&DateTimeCrate::Chrono).as_str(), "Column `id`: Option<String>");
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `id`: Option<String>"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("id"))
|
||||
.string()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(column.get_info(&DateTimeCrate::Chrono).as_str(), "Column `id`: String, not_null");
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `id`: String, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("id"))
|
||||
.string()
|
||||
@ -499,100 +507,100 @@ mod tests {
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("date_field"))
|
||||
.date()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.date()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `date_field`: Date, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("date_field"))
|
||||
.date()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.date()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Time).as_str(),
|
||||
"Column `date_field`: TimeDate, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("time_field"))
|
||||
.time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `time_field`: Time, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("time_field"))
|
||||
.time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Time).as_str(),
|
||||
"Column `time_field`: TimeTime, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("date_time_field"))
|
||||
.date_time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.date_time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `date_time_field`: DateTime, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("date_time_field"))
|
||||
.date_time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.date_time()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Time).as_str(),
|
||||
"Column `date_time_field`: TimeDateTime, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("timestamp_field"))
|
||||
.timestamp()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.timestamp()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `timestamp_field`: DateTimeUtc, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("timestamp_field"))
|
||||
.timestamp()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.timestamp()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Time).as_str(),
|
||||
"Column `timestamp_field`: TimeDateTime, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("timestamp_with_timezone_field"))
|
||||
.timestamp_with_time_zone()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.timestamp_with_time_zone()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Chrono).as_str(),
|
||||
"Column `timestamp_with_timezone_field`: DateTimeWithTimeZone, not_null"
|
||||
);
|
||||
|
||||
let column: Column = ColumnDef::new(Alias::new("timestamp_with_timezone_field"))
|
||||
.timestamp_with_time_zone()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
.timestamp_with_time_zone()
|
||||
.not_null()
|
||||
.to_owned()
|
||||
.into();
|
||||
assert_eq!(
|
||||
column.get_info(&DateTimeCrate::Time).as_str(),
|
||||
"Column `timestamp_with_timezone_field`: TimeDateTimeWithTimeZone, not_null"
|
||||
|
@ -170,7 +170,7 @@ impl RelationDef {
|
||||
/// ```
|
||||
/// use sea_orm::{entity::*, query::*, DbBackend, tests_cfg::{cake, cake_filling}};
|
||||
/// use sea_query::{Expr, IntoCondition};
|
||||
///
|
||||
///
|
||||
/// assert_eq!(
|
||||
/// cake::Entity::find()
|
||||
/// .join(
|
||||
|
Loading…
x
Reference in New Issue
Block a user