UNPKG

studiocms

Version:

Astro Native CMS for AstroDB. Built from the ground up by the Astro community.

21 lines (20 loc) 553 B
import { db as client } from "astro:db"; import { drizzleDBClientLive } from "@withstudiocms/effect/drizzle"; import { Effect } from "../../../effect.js"; import { LibSQLClientError } from "@withstudiocms/effect/drizzle"; class AstroDB extends Effect.Service()("studiocms/sdk/effect/db/AstroDB", { effect: Effect.gen(function* () { const db = client; const { execute, makeQuery } = yield* drizzleDBClientLive({ drizzle: db }); return { db, execute, makeQuery }; }) }) { } export { AstroDB, LibSQLClientError };