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

Function select

cjs/src/types.js:136–151  ·  view source on GitHub ↗
(first, rest, parameters, types, options)

Source from the content-addressed store, hash-verified

134}
135
136function select(first, rest, parameters, types, options) {
137 typeof first === 'string' && (first = [first].concat(rest))
138 if (Array.isArray(first))
139 return escapeIdentifiers(first, options)
140
141 let value
142 const columns = rest.length ? rest.flat() : Object.keys(first)
143 return columns.map(x => {
144 value = first[x]
145 return (
146 value instanceof Query ? fragment(value, parameters, types, options) :
147 value instanceof Identifier ? value.value :
148 handleValue(value, parameters, types, options)
149 ) + ' as ' + escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x)
150 }).join(',')
151}
152
153const builders = Object.entries({
154 values,

Callers

nothing calls this directly

Calls 4

escapeIdentifiersFunction · 0.70
fragmentFunction · 0.70
handleValueFunction · 0.70
escapeIdentifierFunction · 0.50

Tested by

no test coverage detected