UNPKG

sails-postgresql

Version:

a PostgreSQL adapter for Waterline and Sails.js

26 lines (23 loc) 2.37 kB
// ███████╗███████╗ ██████╗ █████╗ ██████╗ ███████╗ ████████╗ █████╗ ██████╗ ██╗ ███████╗ // ██╔════╝██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝ ╚══██╔══╝██╔══██╗██╔══██╗██║ ██╔════╝ // █████╗ ███████╗██║ ███████║██████╔╝█████╗ ██║ ███████║██████╔╝██║ █████╗ // ██╔══╝ ╚════██║██║ ██╔══██║██╔═══╝ ██╔══╝ ██║ ██╔══██║██╔══██╗██║ ██╔══╝ // ███████╗███████║╚██████╗██║ ██║██║ ███████╗ ██║ ██║ ██║██████╔╝███████╗███████╗ // ╚══════╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝ // // ███╗ ██╗ █████╗ ███╗ ███╗███████╗ // ████╗ ██║██╔══██╗████╗ ████║██╔════╝ // ██╔██╗ ██║███████║██╔████╔██║█████╗ // ██║╚██╗██║██╔══██║██║╚██╔╝██║██╔══╝ // ██║ ╚████║██║ ██║██║ ╚═╝ ██║███████╗ // ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ // // Given a table name, escape it for the database and add the postgres schema // if needed. module.exports = function escapeTableName(name, schemaName) { name = '"' + name + '"'; if (schemaName) { name = '"' + schemaName + '".' + name; } return name; };