UNPKG

ts-api-core

Version:

Nodejs api framework core

25 lines 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Result = exports.ResultCode = void 0; const result_code_1 = require("./result.code"); Object.defineProperty(exports, "ResultCode", { enumerable: true, get: function () { return result_code_1.ResultCode; } }); /** `reponse` 通用数据模型 */ class Result { constructor(code, msg, data, reqId, err) { this.code = code; this.msg = msg; this.data = data; this.reqId = reqId; this.err = err; } // 成功 static success(data, msg = undefined, reqId) { return new Result(result_code_1.ResultCode.OK, msg, data, reqId); } // 失败 static failure(code = result_code_1.ResultCode.NO, msg = undefined, data = undefined, reqId, err) { return new Result(code, msg, data, reqId, err); } } exports.Result = Result; //# sourceMappingURL=result.js.map