Closed swaitw closed 1 year ago
Looks like you've misspelled profile
as profille
. Would that be what's causing the problem?
sorry, the spelling is right in my code, but show error like that: user | ^^^^ expected struct prisma::user::Data , found struct find_user_by_email_and_password::{closure#0}::Data |
---|
Ah, you'll want to check out this section of the docs for using include!
types as function return types.
sorry, thanks for your answer but a little bit confused here, do i need create these type manulaly ? if not, where can i find them.
You'll want to do something like this:
use crate::{prisma::{PrismaClient, user::{Data as User, self}}};
user::include!(user_with_profile { profile });
pub async fn find_user_by_email(client: &PrismaClient, email: String) -> user_with_profile::Data {
let user = client
.user()
.find_unique(user::email::equals(email))
.include(user_with_profile::include())
.exec()
.await
.unwrap()
}
works for me, you save my life, thanks a lot for that.
here will show unmatched type. so does anyone know how to fix it? thanks.