sea-orm: the trait `Clone` is not implemented for `DatabaseConnection`

I got the below error when I set a filed as DatabaseConnection type, but such usage works in rocket example, so is there anything I missed?

the trait bound DatabaseConnection: Clone is not satisfied the trait Clone is not implemented for DatabaseConnection

#[derive(Clone)]
pub struct DbStruct {
    db_conn: DatabaseConnection
}
[dependencies]
sea-orm = { version ="^0.8.0", features=["sqlx-postgres", "sqlx-sqlite","runtime-tokio-rustls"]}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@billy1624 can we enable Clone and let the users use it with caution ? Because in my case, each test has their own mock database connection and each test only make one query to the database so I think I won’t run into that problem.

Okay, here is the context for anyone interested in this:

Thanks @billy1624 , I have a last question, could I have any docs on the reason that DatabaseConnection shouldn’t have clone under mock feature? I am just curious about it.