UNPKG

@clickup/ent-framework

Version:

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

44 lines 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ID = void 0; exports.EnumType = EnumType; exports.Base64BufferType = Base64BufferType; exports.JSONType = JSONType; /** * Primary key field's name is currently hardcoded for simplicity. It's a * convention to have it named as "id". */ exports.ID = "id"; /** @ignore */ function EnumType() { return { dbValueToJs: (dbValue) => dbValue, stringify: (jsValue) => jsValue, parse: (str) => str, }; } /** * A value stored in the DB as a base64 encoded binary buffer. Actually, DB * engines (like PostgreSQL) support native binary data fields (and store binary * data efficiently), but sometimes (especially for small things, like * public/private keys), it's easier to store the binary data as base64 encoded * strings rather than dealing with the native binary data type. */ function Base64BufferType() { return { dbValueToJs: (dbValue) => Buffer.from(dbValue, "base64"), stringify: (jsValue) => jsValue.toString("base64"), parse: (str) => Buffer.from(str, "base64"), }; } /** * An arbitrary JSON field type. */ function JSONType() { return { dbValueToJs: (dbValue) => dbValue, stringify: (jsValue) => JSON.stringify(jsValue), parse: (str) => JSON.parse(str), }; } //# sourceMappingURL=types.js.map