Mario564
Mario564
Explore posts from servers
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
Alright, glad to have helped!
16 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
The select types are also very complex so that certainly doesn't help
16 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
There probably is but it's not documented anywhere at the moment
16 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
async function select<T extends SelectedFields>(fields: T) {
const query = db.select(fields).from(users);
return await query.where(eq(users.id, 1)) as Awaited<typeof query>;
}
async function select<T extends SelectedFields>(fields: T) {
const query = db.select(fields).from(users);
return await query.where(eq(users.id, 1)) as Awaited<typeof query>;
}
16 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
Couldn't find a clean solution to this problem, but I did come up with a workaround
16 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
Are you still explicitly defining the return type for the function?
16 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
That should work
16 replies
DTDrizzle Team
Created by lordbinbash on 9/12/2024 in #help
Is it possible to use .map and batch?
@lordbinbash What exactly are those "TS Errors"?
2 replies
DTDrizzle Team
Created by Slime on 9/13/2024 in #help
invalid input either "url" or "host
I suggest updating Drizzle Kit to latest and define the config with defineConfig function
3 replies
DTDrizzle Team
Created by pratyush on 9/14/2024 in #help
old/stale data
Drizzle doesn't cache any query results, so there might an issue with the API you're designing
2 replies
DTDrizzle Team
Created by Torbjørn on 9/15/2024 in #help
How do I use the with statement when inserting with select?
Right now, Drizzle doesn't support insert into ... select syntax, but there is a PR for it on the Github repo
2 replies
DTDrizzle Team
Created by wilsonlewis on 9/16/2024 in #help
DrizzleKit "tablesFilter" not working as expected
By specifying media_service_* in the tablesFilter key, you're saying that you don't want tables with that prefix to be present in migrations and push. I assume that if those tables were previously present and are being filtered afterwards then it will drop those tables
2 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
You could do this:
let postsDb = await /* query */;

postsDb = postsDb.map((posts) => ({
...posts,
postsPicture: Object.values(posts.postsPicture /* in case this errors, add `as any` */)
}));
let postsDb = await /* query */;

postsDb = postsDb.map((posts) => ({
...posts,
postsPicture: Object.values(posts.postsPicture /* in case this errors, add `as any` */)
}));
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
Not sure what exactly is causing this behavior, but I can offer a workaround if you don't mind
19 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
Where is the SelectedFields being imported from? I'm looking at the source code and had forgotten there's one for each dialect, so you have to use the correct one for whatever dialect you're using
16 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
Are you running the latest version of the ORM?
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
I wonder if this is an issue with a particular driver. What driver are you using?
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
Looks good
19 replies
DTDrizzle Team
Created by alexb on 9/18/2024 in #help
How to type a generic selection function
@alexb Use the SelectedFields type (T extends SelectedFields)
16 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
@Lucifer I see you defined the relations to the posts table. Have you defined them for postsPictures? If so, can you share it here?
19 replies