superflare icon indicating copy to clipboard operation
superflare copied to clipboard

idea: Use Drizzle ORM

Open clgeoio opened this issue 1 year ago • 1 comments

Found this repo and I like what's going on! Cloudflare are certainly upping the ante these days and I'm glad to see a opinionated toolkit for it.

Have you considered using Drizzle as an ORM instead of rolling your own? It already has a D1 adapter and also has a migration creation tool too, Drizzle Kit. I've not used Drizzle before, but it looks like it does plenty of things that Superflare is wanting to do.

Some food for thought, excited to see where this project goes next!

clgeoio avatar Oct 10 '23 09:10 clgeoio

It for sure seems like the hot thing right now — I haven't used it before, either.

My gut reaction is that I still prefer the syntax of AR/Eloquent queries over the more verbose syntax of ORM query builders in the JS space:

Drizzle:

// Drizzle
import { eq, lt, gte, ne } from 'drizzle-orm';
 
await db.select().from(users).where(eq(users.id, 42));
await db.select().from(users).where(lt(users.id, 42));
await db.select().from(users).where(gte(users.id, 42));
await db.select().from(users).where(ne(users.id, 42));

Superflare:

import User from './User'

await User.where('id', 42);
await User.where('id', '<', 42);
await User.where('id', '>=', 42);
await User.where('id', '!=', 42);

That said, I'll keep an open mind, especially as Drizzle gains more mindshare 👍

jplhomer avatar Nov 17 '23 12:11 jplhomer