MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / find_linked_active_enum

Function find_linked_active_enum

tests/active_enum_tests.rs:539–663  ·  view source on GitHub ↗
(db: &DatabaseConnection)

Source from the content-addressed store, hash-verified

537}
538
539pub async fn find_linked_active_enum(db: &DatabaseConnection) -> Result<(), DbErr> {
540 assert_eq!(
541 active_enum::Model {
542 id: 2,
543 category: None,
544 color: None,
545 tea: None,
546 }
547 .find_linked(active_enum::ActiveEnumChildLink)
548 .all(db)
549 .await?,
550 [active_enum_child::Model {
551 id: 1,
552 parent_id: 2,
553 category: Some(Category::Big),
554 color: Some(Color::Black),
555 tea: Some(Tea::EverydayTea),
556 }]
557 );
558 assert_eq!(
559 ActiveEnumEntity::find()
560 .find_also_linked(active_enum::ActiveEnumChildLink)
561 .all(db)
562 .await?,
563 [(
564 active_enum::Model {
565 id: 2,
566 category: Some(Category::Small),
567 color: Some(Color::White),
568 tea: Some(Tea::BreakfastTea),
569 },
570 Some(active_enum_child::Model {
571 id: 1,
572 parent_id: 2,
573 category: Some(Category::Big),
574 color: Some(Color::Black),
575 tea: Some(Tea::EverydayTea),
576 })
577 )]
578 );
579 assert_eq!(
580 ActiveEnumEntity::find()
581 .find_with_linked(active_enum::ActiveEnumChildLink)
582 .all(db)
583 .await?,
584 [(
585 active_enum::Model {
586 id: 2,
587 category: Some(Category::Small),
588 color: Some(Color::White),
589 tea: Some(Tea::BreakfastTea),
590 },
591 vec![active_enum_child::Model {
592 id: 1,
593 parent_id: 2,
594 category: Some(Category::Big),
595 color: Some(Color::Black),
596 tea: Some(Tea::EverydayTea),

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected