MCPcopy Create free account
hub / github.com/Effect-TS/effect / get

Method get

packages/sql/pg/src/PgConnection.ts:1488–1509  ·  view source on GitHub ↗
(sql: string, parameterTypes: ReadonlyArray<number>, textResults: boolean)

Source from the content-addressed store, hash-verified

1486 }
1487
1488 get(sql: string, parameterTypes: ReadonlyArray<number>, textResults: boolean): Prepared {
1489 const key = `${textResults ? "T" : "B"}\u0000${parameterTypes.join(",")}\u0000${sql}`
1490 const found = this.statements.get(key)
1491 if (found !== undefined) {
1492 // Re-insert to move it to the end: `Map` iterates in insertion order, so
1493 // the first key is the least recently used one.
1494 this.statements.delete(key)
1495 this.statements.set(key, found)
1496 this.trim(found)
1497 return found
1498 }
1499 const prepared: Prepared = {
1500 name: `effect_${this.namespace}_${++this.counter}`,
1501 key,
1502 ready: false,
1503 parsing: false,
1504 description: undefined
1505 }
1506 this.statements.set(key, prepared)
1507 this.trim(prepared)
1508 return prepared
1509 }
1510
1511 /**
1512 * A statement still being parsed cannot be closed yet: its `Parse` may not

Callers

nothing calls this directly

Calls 5

trimMethod · 0.95
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected