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

Function handleValue

cjs/src/types.js:75–94  ·  view source on GitHub ↗
(x, parameters, types, options)

Source from the content-addressed store, hash-verified

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

Callers 3

stringifyValueFunction · 0.70
selectFunction · 0.70
buildFunction · 0.70

Calls 2

firstIsStringFunction · 0.70
inferTypeFunction · 0.50

Tested by

no test coverage detected