Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrismaValue::List for raw query #408

Open
tingfeng-key opened this issue Oct 28, 2023 · 3 comments
Open

PrismaValue::List for raw query #408

tingfeng-key opened this issue Oct 28, 2023 · 3 comments

Comments

@tingfeng-key
Copy link
Contributor

Can't PrismaListValue work on IN in the original query?

@tingfeng-key
Copy link
Contributor Author

code:

let ids: Vec<i64> = vec![1,2,3,4,5,6];
let data: Vec<QueryReturnType> = client
    ._query_raw(raw!(
        "SELECT id, title FROM Post WHERE id IN ({})",
        PrismaValue::List(ids.iter().map(|x|PrismaValue::Int(*x)).collect::<Vec<PrismaValue>>())
    ))
    .exec()
    .await?;

@tingfeng-key tingfeng-key changed the title PrismaListValue PrismaValue::List for raw query Oct 28, 2023
@Brendonovich
Copy link
Owner

I'm not sure why this doesn't work, I'm curious if using an array in the JS client works, if it does then I've got some research to do.

@tingfeng-key
Copy link
Contributor Author

Prisma uses tag templates to process
Tagged template helpers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants