DrPotat
DrPotat
DDeno
Created by DrPotat on 10/1/2023 in #help
How to assert object with a field of a given type?
I couldn't find anything similar to Jest's expect.any(String) in the Deno testing docs
4 replies
DDeno
Created by DrPotat on 10/1/2023 in #help
How to assert object with a field of a given type?
I'm trying to assert that the data object has an id field of type String , while also asserting the remaining fields with assertObjectMatch
4 replies
DTDrizzle Team
Created by rushil1o1 on 3/28/2023 in #help
Any easy way to create a typescript ENUM type from pgEnum?
Btw @rushil1o1 here's another way to get the values type of a pgEnum, by inspecting the table types instead of using a helper like strEnum : https://discord.com/channels/1043890932593987624/1138161535416553585/1148743897690931400
15 replies
DTDrizzle Team
Created by tmcw on 8/7/2023 in #help
Is there a simpler way to get an enum type than (typeof enumType)["enumValues"][number]?
I wish there was a way to get this type directly from the pgEnum though
7 replies
DTDrizzle Team
Created by tmcw on 8/7/2023 in #help
Is there a simpler way to get an enum type than (typeof enumType)["enumValues"][number]?
For example:
export const orderMethodEnum = pgEnum("order_method", ["PICKUP", "DELIVERY"]);
const order = pgTable("order", {
method: orderMethodEnum("method").notNull(),
});
type OrderMethodValue = typeof order.$inferSelect.method;
export const orderMethodEnum = pgEnum("order_method", ["PICKUP", "DELIVERY"]);
const order = pgTable("order", {
method: orderMethodEnum("method").notNull(),
});
type OrderMethodValue = typeof order.$inferSelect.method;
7 replies
DTDrizzle Team
Created by tmcw on 8/7/2023 in #help
Is there a simpler way to get an enum type than (typeof enumType)["enumValues"][number]?
Another (indirect) way to get the enum values type is by inspecting the table's type:
// When MY_TABLE has a column called COLUMN
type MyEnumType = typeof MY_TABLE.$inferSelect.MY_ENUM_COLUMN
// When MY_TABLE has a column called COLUMN
type MyEnumType = typeof MY_TABLE.$inferSelect.MY_ENUM_COLUMN
7 replies
DTDrizzle Team
Created by tmcw on 8/7/2023 in #help
Is there a simpler way to get an enum type than (typeof enumType)["enumValues"][number]?
Thanks a lot for sharing @Noahh - those snippets are super useful
7 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
We're building an iOS app + web app for splitting bills and stuff
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
That's really cool. I'll have a look
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
If you get it working, can you share how?
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
Seems like there's interest in Drizzle on Deno but not sure how well it works atm: https://github.com/drizzle-team/drizzle-orm/issues/252
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
Drizzle looks really interesting, thanks for sharing it We're still in early stages and not quite convinced with Prisma on Deno
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
We've faced a couple issues with Prisma on Deno: 1 Difficulties importing enums from Prisma client. There seems to be some typing mismatch that prevents us from importing them 2 We need to use Prisma Data Proxy to connect to the database. Otherwise, the Prisma Client generation doesn't work.
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
Then inside deno.json we've got a custom import for $prisma so we can do import { PrismaClient } from "$prisma";
"imports": {
"$prisma": "./prisma/client/deno/edge.ts",
},
"imports": {
"$prisma": "./prisma/client/deno/edge.ts",
},
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
@.braveheart I think the issue is that your Prisma client is being generated inside node_modules - IIRC that doesn't well with Deno (but not sure why)
22 replies
DDeno
Created by Braveheart on 7/25/2023 in #help
Prisma and deno
Yeah, we managed to get Prisma working on Deno but I'm not sure it was worth the effort.. or if we'll keep it
22 replies