1use crate::{
2 ColumnDef, ColumnType, DbBackend, EntityName, Iden, IdenStatic, IntoSimpleExpr, Iterable,
3};
4use sea_query::{
5 BinOper, DynIden, Expr, ExprTrait, IntoIden, IntoLikeExpr, SeaRc, SelectStatement, SimpleExpr,
6 Value,
7};
8use std::{borrow::Cow, str::FromStr};
9
10pub(crate) mod methods {
11 macro_rules! bind_oper {
12 ($vis:vis $op:ident, $bin_op:ident) => {
13 #[allow(missing_docs)]
14 $vis fn $op<V>(&self, v: V) -> SimpleExpr
15 where
16 V: Into<Value>,
17 {
18 let expr = self.save_as(Expr::val(v));
19 Expr::col(self.as_column_ref()).binary(BinOper::$bin_op, expr)
20 }
21 };
22 }
23
24 macro_rules! bind_func_no_params {
25 ($vis:vis $func:ident) => {
26 $vis fn $func(&self) -> SimpleExpr {
28 Expr::col(self.as_column_ref()).$func()
29 }
30 };
31 }
32
33 macro_rules! bind_vec_func {
34 ($vis:vis $func:ident) => {
35 #[allow(missing_docs)]
36 #[allow(clippy::wrong_self_convention)]
37 $vis fn $func<V, I>(&self, v: I) -> SimpleExpr
38 where
39 V: Into<Value>,
40 I: IntoIterator<Item = V>,
41 {
42 let v_with_enum_cast = v.into_iter().map(|v| self.save_as(Expr::val(v)));
43 Expr::col(self.as_column_ref()).$func(v_with_enum_cast)
44 }
45 };
46 }
47
48 macro_rules! bind_subquery_func {
49 ($vis:vis $func:ident) => {
50 #[allow(clippy::wrong_self_convention)]
51 #[allow(missing_docs)]
52 $vis fn $func(&self, s: SelectStatement) -> SimpleExpr {
53 Expr::col(self.as_column_ref()).$func(s)
54 }
55 };
56 }
57
58 pub(crate) use bind_func_no_params;
59 pub(crate) use bind_oper;
60 pub(crate) use bind_subquery_func;
61 pub(crate) use bind_vec_func;
62}
63
64use methods::*;
65
66pub trait ColumnTrait: IdenStatic + Iterable + FromStr {
69 #[allow(missing_docs)]
70 type EntityName: EntityName;
71
72 fn def(&self) -> ColumnDef;
74
75 fn enum_type_name(&self) -> Option<&'static str> {
77 None
78 }
79
80 fn entity_name(&self) -> DynIden {
82 SeaRc::new(Self::EntityName::default())
83 }
84
85 fn as_column_ref(&self) -> (DynIden, DynIden) {
87 (self.entity_name(), SeaRc::new(*self))
88 }
89
90 bind_oper!(eq, Equal);
91 bind_oper!(ne, NotEqual);
92 bind_oper!(gt, GreaterThan);
93 bind_oper!(gte, GreaterThanOrEqual);
94 bind_oper!(lt, SmallerThan);
95 bind_oper!(lte, SmallerThanOrEqual);
96
97 fn between<V>(&self, a: V, b: V) -> SimpleExpr
109 where
110 V: Into<Value>,
111 {
112 Expr::col(self.as_column_ref()).between(a, b)
113 }
114
115 fn not_between<V>(&self, a: V, b: V) -> SimpleExpr
127 where
128 V: Into<Value>,
129 {
130 Expr::col(self.as_column_ref()).not_between(a, b)
131 }
132
133 fn like<T>(&self, s: T) -> SimpleExpr
145 where
146 T: IntoLikeExpr,
147 {
148 Expr::col(self.as_column_ref()).like(s)
149 }
150
151 fn not_like<T>(&self, s: T) -> SimpleExpr
163 where
164 T: IntoLikeExpr,
165 {
166 Expr::col(self.as_column_ref()).not_like(s)
167 }
168
169 fn ilike<T>(&self, s: T) -> SimpleExpr
182 where
183 T: IntoLikeExpr,
184 {
185 use sea_query::extension::postgres::PgExpr;
186
187 Expr::col(self.as_column_ref()).ilike(s)
188 }
189
190 fn not_ilike<T>(&self, s: T) -> SimpleExpr
203 where
204 T: IntoLikeExpr,
205 {
206 use sea_query::extension::postgres::PgExpr;
207
208 Expr::col(self.as_column_ref()).not_ilike(s)
209 }
210
211 fn starts_with<T>(&self, s: T) -> SimpleExpr
228 where
229 T: Into<String>,
230 {
231 let pattern = format!("{}%", s.into());
232 Expr::col(self.as_column_ref()).like(pattern)
233 }
234
235 fn ends_with<T>(&self, s: T) -> SimpleExpr
252 where
253 T: Into<String>,
254 {
255 let pattern = format!("%{}", s.into());
256 Expr::col(self.as_column_ref()).like(pattern)
257 }
258
259 fn contains<T>(&self, s: T) -> SimpleExpr
276 where
277 T: Into<String>,
278 {
279 let pattern = format!("%{}%", s.into());
280 Expr::col(self.as_column_ref()).like(pattern)
281 }
282
283 bind_func_no_params!(max);
284 bind_func_no_params!(min);
285 bind_func_no_params!(sum);
286 bind_func_no_params!(count);
287 bind_func_no_params!(is_null);
288 bind_func_no_params!(is_not_null);
289
290 fn if_null<V>(&self, v: V) -> SimpleExpr
292 where
293 V: Into<Value>,
294 {
295 Expr::col(self.as_column_ref()).if_null(v)
296 }
297
298 bind_vec_func!(is_in);
299 bind_vec_func!(is_not_in);
300
301 #[cfg(feature = "postgres-array")]
314 fn eq_any<V, I>(&self, v: I) -> SimpleExpr
315 where
316 V: Into<Value> + sea_query::ValueType + sea_query::with_array::NotU8,
317 I: IntoIterator<Item = V>,
318 {
319 use sea_query::extension::postgres::PgFunc;
320
321 let vec: Vec<_> = v.into_iter().collect();
322 Expr::col(self.as_column_ref()).eq(PgFunc::any(vec))
323 }
324
325 bind_subquery_func!(in_subquery);
326 bind_subquery_func!(not_in_subquery);
327
328 fn into_expr(self) -> Expr {
330 self.into_simple_expr()
331 }
332
333 #[allow(clippy::match_single_binding)]
335 fn into_returning_expr(self, db_backend: DbBackend) -> Expr {
336 match db_backend {
337 _ => Expr::col(self),
338 }
339 }
340
341 fn select_as(&self, expr: Expr) -> SimpleExpr {
344 self.select_enum_as(expr)
345 }
346
347 fn select_enum_as(&self, expr: Expr) -> SimpleExpr {
349 cast_enum_as(expr, &self.def(), select_enum_as)
350 }
351
352 fn save_as(&self, val: Expr) -> SimpleExpr {
355 self.save_enum_as(val)
356 }
357
358 fn save_enum_as(&self, val: Expr) -> SimpleExpr {
360 cast_enum_as(val, &self.def(), save_enum_as)
361 }
362}
363
364pub trait ColumnTypeTrait {
366 fn def(self) -> ColumnDef;
368
369 fn get_enum_name(&self) -> Option<&DynIden>;
371}
372
373impl ColumnTypeTrait for ColumnType {
374 fn def(self) -> ColumnDef {
375 ColumnDef {
376 col_type: self,
377 null: false,
378 unique: false,
379 indexed: false,
380 default: None,
381 comment: None,
382 unique_key: None,
383 renamed_from: None,
384 extra: None,
385 seaography: Default::default(),
386 }
387 }
388
389 fn get_enum_name(&self) -> Option<&DynIden> {
390 enum_name(self)
391 }
392}
393
394impl ColumnTypeTrait for ColumnDef {
395 fn def(self) -> ColumnDef {
396 self
397 }
398
399 fn get_enum_name(&self) -> Option<&DynIden> {
400 enum_name(&self.col_type)
401 }
402}
403
404fn enum_name(col_type: &ColumnType) -> Option<&DynIden> {
405 match col_type {
406 ColumnType::Enum { name, .. } => Some(name),
407 ColumnType::Array(col_type) => enum_name(col_type),
408 _ => None,
409 }
410}
411
412struct Text;
413struct TextArray;
414
415impl Iden for Text {
416 fn quoted(&self) -> Cow<'static, str> {
417 Cow::Borrowed("text")
418 }
419
420 fn unquoted(&self) -> &str {
421 match self.quoted() {
422 Cow::Borrowed(s) => s,
423 _ => unreachable!(),
424 }
425 }
426}
427
428impl Iden for TextArray {
429 fn quoted(&self) -> Cow<'static, str> {
430 Cow::Borrowed("text[]")
432 }
433
434 fn unquoted(&self) -> &str {
435 match self.quoted() {
436 Cow::Borrowed(s) => s,
437 _ => unreachable!(),
438 }
439 }
440}
441
442pub(crate) fn select_enum_as(col: Expr, _: DynIden, col_type: &ColumnType) -> SimpleExpr {
443 let type_name = match col_type {
444 ColumnType::Array(_) => TextArray.into_iden(),
445 _ => Text.into_iden(),
446 };
447 col.as_enum(type_name)
448}
449
450pub(crate) fn save_enum_as(col: Expr, enum_name: DynIden, col_type: &ColumnType) -> SimpleExpr {
451 let type_name = match col_type {
452 ColumnType::Array(_) => format!("{enum_name}[]").into_iden(),
453 _ => enum_name,
454 };
455 col.as_enum(type_name)
456}
457
458pub(crate) fn cast_enum_as<F>(expr: Expr, col_def: &ColumnDef, f: F) -> SimpleExpr
459where
460 F: Fn(Expr, DynIden, &ColumnType) -> SimpleExpr,
461{
462 let col_type = col_def.get_column_type();
463
464 match col_type {
465 #[cfg(all(feature = "with-json", feature = "postgres-array"))]
466 ColumnType::Json | ColumnType::JsonBinary => {
467 use sea_query::ArrayType;
468 use serde_json::Value as Json;
469
470 match expr {
471 SimpleExpr::Value(Value::Array(ArrayType::Json, Some(json_vec))) => {
472 let json_vec: Vec<Json> = json_vec
474 .into_iter()
475 .filter_map(|val| match val {
476 Value::Json(Some(json)) => Some(json),
477 _ => None,
478 })
479 .collect();
480 SimpleExpr::Value(Value::Json(Some(json_vec.into())))
481 }
482 SimpleExpr::Value(Value::Array(ArrayType::Json, None)) => {
483 SimpleExpr::Value(Value::Json(None))
484 }
485 _ => expr,
486 }
487 }
488 _ => match col_type.get_enum_name() {
489 Some(enum_name) => f(expr, enum_name.clone(), col_type),
490 None => expr,
491 },
492 }
493}
494
495#[cfg(test)]
496mod tests {
497 use crate::{
498 ColumnTrait, Condition, DbBackend, EntityTrait, QueryFilter, QueryTrait, tests_cfg::*,
499 };
500 use sea_query::Query;
501
502 #[test]
503 fn test_in_subquery_1() {
504 assert_eq!(
505 cake::Entity::find()
506 .filter(
507 Condition::any().add(
508 cake::Column::Id.in_subquery(
509 Query::select()
510 .expr(cake::Column::Id.max())
511 .from(cake::Entity)
512 .to_owned()
513 )
514 )
515 )
516 .build(DbBackend::MySql)
517 .to_string(),
518 [
519 "SELECT `cake`.`id`, `cake`.`name` FROM `cake`",
520 "WHERE `cake`.`id` IN (SELECT MAX(`cake`.`id`) FROM `cake`)",
521 ]
522 .join(" ")
523 );
524 }
525
526 #[test]
527 fn test_in_subquery_2() {
528 assert_eq!(
529 cake::Entity::find()
530 .filter(
531 Condition::any().add(
532 cake::Column::Id.in_subquery(
533 Query::select()
534 .column(cake_filling::Column::CakeId)
535 .from(cake_filling::Entity)
536 .to_owned()
537 )
538 )
539 )
540 .build(DbBackend::MySql)
541 .to_string(),
542 [
543 "SELECT `cake`.`id`, `cake`.`name` FROM `cake`",
544 "WHERE `cake`.`id` IN (SELECT `cake_id` FROM `cake_filling`)",
545 ]
546 .join(" ")
547 );
548 }
549
550 #[test]
551 #[cfg(feature = "macros")]
552 fn select_as_1() {
553 use crate::{ActiveModelTrait, ActiveValue, Update};
554
555 mod hello_expanded {
556 use crate as sea_orm;
557 use crate::entity::prelude::*;
558 use crate::sea_query::{Expr, ExprTrait, SimpleExpr};
559
560 #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
561 pub struct Entity;
562
563 impl EntityName for Entity {
564 fn table_name(&self) -> &'static str {
565 "hello"
566 }
567 }
568
569 #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
570 pub struct Model {
571 pub id: i32,
572 #[sea_orm(enum_name = "One1")]
573 pub one: i32,
574 pub two: i32,
575 #[sea_orm(enum_name = "Three3")]
576 pub three: i32,
577 }
578
579 #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
580 pub enum Column {
581 Id,
582 One1,
583 Two,
584 Three3,
585 }
586
587 impl ColumnTrait for Column {
588 type EntityName = Entity;
589
590 fn def(&self) -> ColumnDef {
591 match self {
592 Column::Id => ColumnType::Integer.def(),
593 Column::One1 => ColumnType::Integer.def(),
594 Column::Two => ColumnType::Integer.def(),
595 Column::Three3 => ColumnType::Integer.def(),
596 }
597 }
598
599 fn select_as(&self, expr: Expr) -> SimpleExpr {
600 match self {
601 Self::Two => expr.cast_as("integer"),
602 _ => self.select_enum_as(expr),
603 }
604 }
605 }
606
607 #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
608 pub enum PrimaryKey {
609 Id,
610 }
611
612 impl PrimaryKeyTrait for PrimaryKey {
613 type ValueType = i32;
614
615 fn auto_increment() -> bool {
616 true
617 }
618 }
619
620 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
621 pub enum Relation {}
622
623 impl ActiveModelBehavior for ActiveModel {}
624 }
625
626 #[allow(clippy::enum_variant_names)]
627 mod hello_compact {
628 use crate as sea_orm;
629 use crate::entity::prelude::*;
630
631 #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
632 #[sea_orm(table_name = "hello")]
633 pub struct Model {
634 #[sea_orm(primary_key)]
635 pub id: i32,
636 #[sea_orm(enum_name = "One1")]
637 pub one: i32,
638 #[sea_orm(select_as = "integer")]
639 pub two: i32,
640 #[sea_orm(enum_name = "Three3")]
641 pub three: i32,
642 }
643
644 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
645 pub enum Relation {}
646
647 impl ActiveModelBehavior for ActiveModel {}
648 }
649
650 fn assert_it<E, A>(active_model: A)
651 where
652 E: EntityTrait,
653 A: ActiveModelTrait<Entity = E>,
654 {
655 assert_eq!(
656 E::find().build(DbBackend::Postgres).to_string(),
657 r#"SELECT "hello"."id", "hello"."one1", CAST("hello"."two" AS integer), "hello"."three3" FROM "hello""#,
658 );
659 assert_eq!(
660 Update::one(active_model)
661 .validate()
662 .unwrap()
663 .build(DbBackend::Postgres)
664 .to_string(),
665 r#"UPDATE "hello" SET "one1" = 1, "two" = 2, "three3" = 3 WHERE "hello"."id" = 1"#,
666 );
667 }
668
669 assert_it(hello_expanded::ActiveModel {
670 id: ActiveValue::set(1),
671 one: ActiveValue::set(1),
672 two: ActiveValue::set(2),
673 three: ActiveValue::set(3),
674 });
675 assert_it(hello_compact::ActiveModel {
676 id: ActiveValue::set(1),
677 one: ActiveValue::set(1),
678 two: ActiveValue::set(2),
679 three: ActiveValue::set(3),
680 });
681 }
682
683 #[test]
684 #[cfg(feature = "macros")]
685 fn save_as_1() {
686 use crate::{ActiveModelTrait, ActiveValue, Update};
687
688 mod hello_expanded {
689 use crate as sea_orm;
690 use crate::entity::prelude::*;
691 use crate::sea_query::{Expr, ExprTrait, SimpleExpr};
692
693 #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
694 pub struct Entity;
695
696 impl EntityName for Entity {
697 fn table_name(&self) -> &'static str {
698 "hello"
699 }
700 }
701
702 #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
703 pub struct Model {
704 pub id: i32,
705 #[sea_orm(enum_name = "One1")]
706 pub one: i32,
707 pub two: i32,
708 #[sea_orm(enum_name = "Three3")]
709 pub three: i32,
710 }
711
712 #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
713 pub enum Column {
714 Id,
715 One1,
716 Two,
717 Three3,
718 }
719
720 impl ColumnTrait for Column {
721 type EntityName = Entity;
722
723 fn def(&self) -> ColumnDef {
724 match self {
725 Column::Id => ColumnType::Integer.def(),
726 Column::One1 => ColumnType::Integer.def(),
727 Column::Two => ColumnType::Integer.def(),
728 Column::Three3 => ColumnType::Integer.def(),
729 }
730 }
731
732 fn save_as(&self, val: Expr) -> SimpleExpr {
733 match self {
734 Self::Two => val.cast_as("text"),
735 _ => self.save_enum_as(val),
736 }
737 }
738 }
739
740 #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
741 pub enum PrimaryKey {
742 Id,
743 }
744
745 impl PrimaryKeyTrait for PrimaryKey {
746 type ValueType = i32;
747
748 fn auto_increment() -> bool {
749 true
750 }
751 }
752
753 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
754 pub enum Relation {}
755
756 impl ActiveModelBehavior for ActiveModel {}
757 }
758
759 #[allow(clippy::enum_variant_names)]
760 mod hello_compact {
761 use crate as sea_orm;
762 use crate::entity::prelude::*;
763
764 #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
765 #[sea_orm(table_name = "hello")]
766 pub struct Model {
767 #[sea_orm(primary_key)]
768 pub id: i32,
769 #[sea_orm(enum_name = "One1")]
770 pub one: i32,
771 #[sea_orm(save_as = "text")]
772 pub two: i32,
773 #[sea_orm(enum_name = "Three3")]
774 pub three: i32,
775 }
776
777 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
778 pub enum Relation {}
779
780 impl ActiveModelBehavior for ActiveModel {}
781 }
782
783 fn assert_it<E, A>(active_model: A)
784 where
785 E: EntityTrait,
786 A: ActiveModelTrait<Entity = E>,
787 {
788 assert_eq!(
789 E::find().build(DbBackend::Postgres).to_string(),
790 r#"SELECT "hello"."id", "hello"."one1", "hello"."two", "hello"."three3" FROM "hello""#,
791 );
792 assert_eq!(
793 Update::one(active_model)
794 .validate()
795 .unwrap()
796 .build(DbBackend::Postgres)
797 .to_string(),
798 r#"UPDATE "hello" SET "one1" = 1, "two" = CAST(2 AS text), "three3" = 3 WHERE "hello"."id" = 1"#,
799 );
800 }
801
802 assert_it(hello_expanded::ActiveModel {
803 id: ActiveValue::set(1),
804 one: ActiveValue::set(1),
805 two: ActiveValue::set(2),
806 three: ActiveValue::set(3),
807 });
808 assert_it(hello_compact::ActiveModel {
809 id: ActiveValue::set(1),
810 one: ActiveValue::set(1),
811 two: ActiveValue::set(2),
812 three: ActiveValue::set(3),
813 });
814 }
815
816 #[test]
817 #[cfg(feature = "macros")]
818 fn select_as_and_value_1() {
819 use crate::{ActiveModelTrait, ActiveValue, Update};
820
821 mod hello_expanded {
822 use crate as sea_orm;
823 use crate::entity::prelude::*;
824 use crate::sea_query::{Expr, ExprTrait, SimpleExpr};
825
826 #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
827 pub struct Entity;
828
829 impl EntityName for Entity {
830 fn table_name(&self) -> &'static str {
831 "hello"
832 }
833 }
834
835 #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
836 pub struct Model {
837 pub id: i32,
838 #[sea_orm(enum_name = "One1")]
839 pub one: i32,
840 pub two: i32,
841 #[sea_orm(enum_name = "Three3")]
842 pub three: i32,
843 }
844
845 #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
846 pub enum Column {
847 Id,
848 One1,
849 Two,
850 Three3,
851 }
852
853 impl ColumnTrait for Column {
854 type EntityName = Entity;
855
856 fn def(&self) -> ColumnDef {
857 match self {
858 Column::Id => ColumnType::Integer.def(),
859 Column::One1 => ColumnType::Integer.def(),
860 Column::Two => ColumnType::Integer.def(),
861 Column::Three3 => ColumnType::Integer.def(),
862 }
863 }
864
865 fn select_as(&self, expr: Expr) -> SimpleExpr {
866 match self {
867 Self::Two => expr.cast_as("integer"),
868 _ => self.select_enum_as(expr),
869 }
870 }
871
872 fn save_as(&self, val: Expr) -> SimpleExpr {
873 match self {
874 Self::Two => val.cast_as("text"),
875 _ => self.save_enum_as(val),
876 }
877 }
878 }
879
880 #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
881 pub enum PrimaryKey {
882 Id,
883 }
884
885 impl PrimaryKeyTrait for PrimaryKey {
886 type ValueType = i32;
887
888 fn auto_increment() -> bool {
889 true
890 }
891 }
892
893 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
894 pub enum Relation {}
895
896 impl ActiveModelBehavior for ActiveModel {}
897 }
898
899 #[allow(clippy::enum_variant_names)]
900 mod hello_compact {
901 use crate as sea_orm;
902 use crate::entity::prelude::*;
903
904 #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
905 #[sea_orm(table_name = "hello")]
906 pub struct Model {
907 #[sea_orm(primary_key)]
908 pub id: i32,
909 #[sea_orm(enum_name = "One1")]
910 pub one: i32,
911 #[sea_orm(select_as = "integer", save_as = "text")]
912 pub two: i32,
913 #[sea_orm(enum_name = "Three3")]
914 pub three: i32,
915 }
916
917 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
918 pub enum Relation {}
919
920 impl ActiveModelBehavior for ActiveModel {}
921 }
922
923 fn assert_it<E, A>(active_model: A)
924 where
925 E: EntityTrait,
926 A: ActiveModelTrait<Entity = E>,
927 {
928 assert_eq!(
929 E::find().build(DbBackend::Postgres).to_string(),
930 r#"SELECT "hello"."id", "hello"."one1", CAST("hello"."two" AS integer), "hello"."three3" FROM "hello""#,
931 );
932 assert_eq!(
933 Update::one(active_model)
934 .validate()
935 .unwrap()
936 .build(DbBackend::Postgres)
937 .to_string(),
938 r#"UPDATE "hello" SET "one1" = 1, "two" = CAST(2 AS text), "three3" = 3 WHERE "hello"."id" = 1"#,
939 );
940 }
941
942 assert_it(hello_expanded::ActiveModel {
943 id: ActiveValue::set(1),
944 one: ActiveValue::set(1),
945 two: ActiveValue::set(2),
946 three: ActiveValue::set(3),
947 });
948 assert_it(hello_compact::ActiveModel {
949 id: ActiveValue::set(1),
950 one: ActiveValue::set(1),
951 two: ActiveValue::set(2),
952 three: ActiveValue::set(3),
953 });
954 }
955}