文件操作 - _utils.mjs
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/db0/integrations/drizzle/_utils.mjs
编辑文件内容
import { getTableName, is, Column, SQL } from "drizzle-orm"; export function mapResultRow(columns, row, joinsNotNullableMap) { const nullifyMap = {}; const result = columns.reduce( (result2, { path, field }, columnIndex) => { let decoder; if (is(field, Column)) { decoder = field; } else if (is(field, SQL)) { decoder = "decoder" in field && field.decoder; } else { decoder = "decoder" in field.sql && field.sql.decoder; } let node = result2; for (const [pathChunkIndex, pathChunk] of path.entries()) { if (pathChunkIndex < path.length - 1) { if (!(pathChunk in node)) { node[pathChunk] = {}; } node = node[pathChunk]; } else { const rawValue = row[columnIndex]; const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue); if (joinsNotNullableMap && is(field, Column) && path.length === 2) { const objectName = path[0]; if (!(objectName in nullifyMap)) { nullifyMap[objectName] = value === null ? getTableName(field.table) : false; } else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) { nullifyMap[objectName] = false; } } } } return result2; }, {} ); if (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) { for (const [objectName, tableName] of Object.entries(nullifyMap)) { if (typeof tableName === "string" && !joinsNotNullableMap[tableName]) { result[objectName] = null; } } } return result; }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件