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

Method _getSafeKey

src/dialects/abstract/query-generator.js:2746–2767  ·  view source on GitHub ↗
(key, prefix)

Source from the content-addressed store, hash-verified

2744 }
2745
2746 _getSafeKey(key, prefix) {
2747 if (key instanceof Utils.SequelizeMethod) {
2748 key = this.handleSequelizeMethod(key);
2749 return this._prefixKey(this.handleSequelizeMethod(key), prefix);
2750 }
2751
2752 if (Utils.isColString(key)) {
2753 key = key.substr(1, key.length - 2).split('.');
2754
2755 if (key.length > 2) {
2756 key = [
2757 // join the tables by -> to match out internal namings
2758 key.slice(0, -1).join('->'),
2759 key[key.length - 1]
2760 ];
2761 }
2762
2763 return key.map(identifier => this.quoteIdentifier(identifier)).join('.');
2764 }
2765
2766 return this._prefixKey(this.quoteIdentifier(key), prefix);
2767 }
2768
2769 _prefixKey(key, prefix) {
2770 if (prefix) {

Callers 1

_joinKeyValueMethod · 0.95

Calls 3

handleSequelizeMethodMethod · 0.95
_prefixKeyMethod · 0.95
quoteIdentifierMethod · 0.95

Tested by

no test coverage detected