Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jul 17, 2024
1 parent 55d520e commit b4e7b41
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/sql-kysely/test/Sqlite.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Sql from "@effect/sql"
import { Schema } from "@effect/schema"
import { SqlResolver } from "@effect/sql"
import * as SqliteKysely from "@effect/sql-kysely/Sqlite"
import * as Sqlite from "@effect/sql-sqlite-node"
import {Schema} from "@effect/schema"
import { assert, describe, it } from "@effect/vitest"
import { Config, Context, Effect, Exit, Layer, Option } from "effect"
import type { Generated } from "kysely"
Expand Down Expand Up @@ -52,25 +52,25 @@ describe("SqliteKysely", () => {
}).pipe(Effect.provide(KyselyLive)))

it.effect("select with resolver", () =>
Effect.gen(function*(_) {
Effect.gen(function*() {
const db = yield* SqliteDB

yield* db.schema
.createTable("users")
.addColumn("id", "integer", (c) => c.primaryKey().autoIncrement())
.addColumn("name", "text", (c) => c.notNull())

yield* db.insertInto("users").values({ name: "Alice" })
yield* db.insertInto("users").values({ name: "Bob" })
yield* db.insertInto("users").values({ name: "Charlie" })
const GetUserById = yield* Sql.SqlResolver.findById("GetUserById", {

const GetUserById = yield* SqlResolver.findById("GetUserById", {
Id: Schema.Number,
Result: Schema.Struct({ id: Schema.Number, name: Schema.String }),
ResultId: (data) => data.id,
execute: (ids) => db.selectFrom("users").where("id", "in", ids).selectAll()
})

const todoIds = [1, 2, 3].map((_) => GetUserById.execute(_))
const result = yield* Effect.all(todoIds, { batching: true })
assert.deepStrictEqual(result, [
Expand Down

0 comments on commit b4e7b41

Please sign in to comment.