MCPcopy Create free account
hub / github.com/porsager/postgres / handleValue

Function handleValue

cf/src/types.js:76–95  ·  view source on GitHub ↗
(x, parameters, types, options)

Source from the content-addressed store, hash-verified

74}
75
76export function handleValue(x, parameters, types, options) {
77 let value = x instanceof Parameter ? x.value : x
78 if (value === undefined) {
79 x instanceof Parameter
80 ? x.value = options.transform.undefined
81 : value = x = options.transform.undefined
82
83 if (value === undefined)
84 throw Errors.generic('UNDEFINED_VALUE', 'Undefined values are not allowed')
85 }
86
87 return '$' + (types.push(
88 x instanceof Parameter
89 ? (parameters.push(x.value), x.array
90 ? x.array[x.type || inferType(x.value)] || x.type || firstIsString(x.value)
91 : x.type
92 )
93 : (parameters.push(x), inferType(x))
94 ))
95}
96
97const defaultHandlers = typeHandlers(types)
98

Callers 3

buildFunction · 0.90
stringifyValueFunction · 0.70
selectFunction · 0.70

Calls 2

inferTypeFunction · 0.70
firstIsStringFunction · 0.70

Tested by

no test coverage detected