MCPcopy Create free account
hub / github.com/effect-app/libs / parseRow

Function parseRow

packages/infra/src/Store/SQL/Pg.ts:18–25  ·  view source on GitHub ↗
(
  row: { id: string; _etag: string | null; data: unknown },
  idKey: PropertyKey,
  defaultValues: Partial<Encoded>
)

Source from the content-addressed store, hash-verified

16import { buildWhereSQLQuery, logQuery, pgDialect } from "./query.ts"
17
18const sqlErrorMessage = (e: unknown) => (e as any)?.message ? String((e as any).message) : String(e)
19const sqlIsTransient = (e: unknown) =>
20 /timeout|ETIMEDOUT|ECONNRESET|ECONNREFUSED|connection|deadlock|too many connections/i.test(sqlErrorMessage(e))
21// Map a SqlError into a typed, serializable DatabaseError (instead of `.orDie`,
22// which would turn it into an opaque, non-serializable defect).
23const toDatabaseError = (e: unknown) =>
24 new DatabaseError({ message: `SQL request failed: ${sqlErrorMessage(e)}`, transient: sqlIsTransient(e), cause: e })
25// withTransaction may re-raise setInternal's typed errors or add SqlError on begin/commit.
26// Preserve DatabaseError / OCC by `_tag` (not instanceof — dual package instances break it);
27// map residual SQL failures to DatabaseError.
28const preserveStoreError = (e: unknown): DatabaseError | OptimisticConcurrencyException => {

Callers 1

Pg.tsFile · 0.70

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…