| 199 | } |
| 200 | |
| 201 | function typeHandlers(types) { |
| 202 | return Object.keys(types).reduce((acc, k) => { |
| 203 | types[k].from && [].concat(types[k].from).forEach(x => acc.parsers[x] = types[k].parse) |
| 204 | if (types[k].serialize) { |
| 205 | acc.serializers[types[k].to] = types[k].serialize |
| 206 | types[k].from && [].concat(types[k].from).forEach(x => acc.serializers[x] = types[k].serialize) |
| 207 | } |
| 208 | return acc |
| 209 | }, { parsers: {}, serializers: {} }) |
| 210 | } |
| 211 | |
| 212 | function escapeIdentifiers(xs, { transform: { column } }) { |
| 213 | return xs.map(x => escapeIdentifier(column.to ? column.to(x) : x)).join(',') |