MCPcopy
hub / github.com/sequelize/sequelize / _getSafeKey

Method _getSafeKey

lib/dialects/abstract/query-generator.js:2561–2582  ·  view source on GitHub ↗
(key, prefix)

Source from the content-addressed store, hash-verified

2559 }
2560
2561 _getSafeKey(key, prefix) {
2562 if (key instanceof Utils.SequelizeMethod) {
2563 key = this.handleSequelizeMethod(key);
2564 return this._prefixKey(this.handleSequelizeMethod(key), prefix);
2565 }
2566
2567 if (Utils.isColString(key)) {
2568 key = key.substr(1, key.length - 2).split('.');
2569
2570 if (key.length > 2) {
2571 key = [
2572 // join the tables by -> to match out internal namings
2573 key.slice(0, -1).join('->'),
2574 key[key.length - 1]
2575 ];
2576 }
2577
2578 return key.map(identifier => this.quoteIdentifier(identifier)).join('.');
2579 }
2580
2581 return this._prefixKey(this.quoteIdentifier(key), prefix);
2582 }
2583
2584 _prefixKey(key, prefix) {
2585 if (prefix) {

Callers 1

_joinKeyValueMethod · 0.95

Calls 3

handleSequelizeMethodMethod · 0.95
_prefixKeyMethod · 0.95
quoteIdentifierMethod · 0.95

Tested by

no test coverage detected