Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.8k stars 104 forks source link

Weird types when batching `FindMany` #208

Closed codemaster138 closed 1 year ago

codemaster138 commented 1 year ago

I'm working on a server that uses Prisma Client Rust to interact with its database. One of its endpoints needs to run multiple find_many queries, so I'm trying to batch them into a single request. My code looks something like this:

use crate::prisma::my_object::{Data, FindMany};

let db: &PrismaClient = todo!();

let queries: (FindMany, FindMany) = todo!();

let results = db
    ._batch(queries)
    .await
    .unwrap(); 

Now, I would expect results to be a tuple with one item corresponding to each item in queries and containing a Vec<Data> since each FindMany query should return a Vec<Data>.

However, the actual type of results is (Data, Data).

Is my code wrong, or is this another code generation bug?

Brendonovich commented 1 year ago

Not a codegen bug but a library bug, is an easy fix

Brendonovich commented 1 year ago

@codemaster138 should be fixed in rev = "999f772cfd4d5185b451ec8d5a018b2f5f7b17d7"

codemaster138 commented 1 year ago

Yep, seems to be working