@lantsang/nestjs-tdengine
Version:
NestJS TDengine 驱动
41 lines (40 loc) • 1.8 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FindUtil = void 0;
const common_1 = require("@nestjs/common");
const format_util_1 = require("./format.util");
let FindUtil = class FindUtil {
constructor(formatUtil) {
this.formatUtil = formatUtil;
}
/**
* 解析查询原始数据
* @param param0 查询原始数据
* @returns 解析后的数据
*/
resolveLastOne({ column_meta: columnMeta, data }) {
const [raw] = data;
if (!raw)
return null;
const result = {};
for (const [index, [column, type]] of columnMeta.entries()) {
const columnNameStage1 = this.formatUtil.underlineToSmallHump(column);
result[columnNameStage1.slice(5, columnNameStage1.length - 1)] = this.formatUtil.getValue(raw[index], type);
}
return result;
}
};
FindUtil = __decorate([
common_1.Injectable(),
__metadata("design:paramtypes", [format_util_1.FormatUtil])
], FindUtil);
exports.FindUtil = FindUtil;