Effect CommunityEC
Effect Community2y ago
4 replies
lagrange6

Create an SQL client with a socket

When I create an SQL client with a socket like the code below

import { Config, Effect, Struct, pipe } from "effect"
import { PgClient } from "@effect/sql-pg"
import { SqlClient } from "@effect/sql"
import * as Secret from "effect/Secret";

const SqlLive = PgClient.layer({
  database: Config.succeed("local"),
  username: Config.succeed("root"),
  password: Config.succeed( Secret.fromString("root")),
  path: Config.succeed("/Users/xxxxxx/Library/Application Support/Local/run/xxxxxxxx/mysql/mysqld.sock")
})

const program = Effect.gen(function* () {
  const sql = yield* SqlClient.SqlClient

  const id = yield* sql<{
    readonly id: number[]
  }>SELECT id FROM wp_35_posts


  yield* Effect.log(Got ${id} results!)
})

pipe(program, Effect.provide(SqlLive), Effect.runPromise)


I got this error.
Postgres.js : Unknown Message: 74
Postgres.js : Unknown Message: 74
Postgres.js : Unknown Message: 74
Postgres.js : Unknown Message: 74


Question
What does this error imply?
How to log a debug message with a more helpful one?
How do I fix it?
Was this page helpful?