effect-drizzle
v0.0.14
Published
Integrates [drizzle-orm](https://github.com/drizzle-team/drizzle-orm) and [@effect](https://github.com/effect-ts).
Downloads
17
Readme
effect-drizzle
Integrates drizzle-orm and @effect.
⚠️ Under development, working on PostgreSQL right now. Will add SQLite and MySQL (maybe more) when the PostgreSQL API is stable.
Example
import { InferModel } from "drizzle-orm"
import {
db,
pgTable,
serial,
text,
runQuery,
runQueryOne
} from "effect-drizzle/pg"
const posts = pgTable("posts", {
id: serial("id").primaryKey(),
name: text("title").notNull(),
});
type Post = InferModel<typeof posts>;
const post1 = runQuery(db.select.from(posts));
// ^ Effect<PgConnection, PgError, Post>
const post2 = runQueryOne(db.select.from(posts));
// ^ Effect<PgConnection, PgError | NotFound, Post>
const post3 = runQueryExactlyOne(db.select.from(posts));
// ^ Effect<PgConnection, PgError | NotFound | TooMany, Post>