UNPKG

s3-orm

Version:

Object-Relational Mapping (ORM) interface for Amazon S3, enabling model-based data operations with indexing and querying capabilities

34 lines 1.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IntegerType = void 0; const lodash_1 = require("lodash"); const chance_1 = __importDefault(require("chance")); const chance = new chance_1.default(); class IntegerType { static mock() { return chance.integer({ min: -20000, max: 20000 }); } static encode(val) { if (!val || val === null || val === undefined) { return ''; } return val + ''; } static decode(val) { if (!val || val === null || val === undefined) { throw new Error(`Trying to load a integer column and got an invalid value: ${val}`); } let numb = parseInt(val); if ((0, lodash_1.isFinite)(numb)) { return numb; } return null; } } exports.IntegerType = IntegerType; IntegerType.isNumeric = true; IntegerType.typeName = "integer"; //# sourceMappingURL=IntegerType.js.map