MCPcopy
hub / github.com/CapSoftware/Cap / updateIfDefined

Function updateIfDefined

packages/database/index.ts:28–29  ·  view source on GitHub ↗
(v: T | undefined, col: AnyMySqlColumn)

Source from the content-addressed store, hash-verified

26
27// Use the incoming value if one exists, else fallback to the DBs existing value.
28export const updateIfDefined = <T>(v: T | undefined, col: AnyMySqlColumn) =>
29 sql`COALESCE(${v === undefined ? sql`NULL` : v}, ${col})`;

Callers 2

multipart.tsFile · 0.90
signed.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected