UNPKG

@clickup/ent-framework

Version:

A PostgreSQL graph-database-alike library with microsharding and row-level security

28 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.escapeAny = escapeAny; const escapeArray_1 = require("./escapeArray"); const escapeBoolean_1 = require("./escapeBoolean"); const escapeDate_1 = require("./escapeDate"); const escapeString_1 = require("./escapeString"); /** * Tries its best to escape the value according to its type. * * Try to not use this function; although it protects against SQL injections, * it's not aware of the actual field type, so it e.g. cannot prevent a bigint * overflow SQL error. */ function escapeAny(v) { return v === null || v === undefined ? "NULL" : typeof v === "number" ? v.toString() : typeof v === "boolean" ? (0, escapeBoolean_1.escapeBoolean)(v) : v instanceof Date ? (0, escapeDate_1.escapeDate)(v) : v instanceof Array ? (0, escapeArray_1.escapeArray)(v) : (0, escapeString_1.escapeString)(v); } //# sourceMappingURL=escapeAny.js.map