effect-supabase
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

effect-supabase

An Effect wrapper for the Supabase sdk.

Database queries

Queries are inspired by and hope to be as complete as those provided by sqlfx.

import { Supabase } from "effect-supabase";
import { Schema } from "@effect/schema";

const EventId = Schema.Int.pipe(Schema.brand(""EventId));

const Event = Schema.Struct({
  starts: Schema.Date
});

export const getEventById = (id: EventId) =>
  Effect.flatMap(Supabase, (sb) =>
    Supabase.resolver("getEventById", {
        result: Event,
        request: EventId,
 run: (ids) => sb.client.from("events").select("*").in("id", ids)
    }).execute(id)
  ).pipe(Effect.withSpan("getEventById", { attributes: { id } }));

Package Sidebar

Install

npm i effect-supabase

Weekly Downloads

24

Version

0.0.13

License

MIT

Unpacked Size

82.8 kB

Total Files

15

Last publish

Collaborators

  • kellyjesse881