Skip to content

Commit

Permalink
Set toNative() to be not enumerable (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
godfreykao authored and elhigu committed Jan 3, 2018
1 parent 45f5ffb commit 59f6cba
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/query/compiler.js
Expand Up @@ -52,13 +52,21 @@ assign(QueryCompiler.prototype, {
timeout: this.timeout,
cancelOnTimeout: this.cancelOnTimeout,
bindings: this.formatter.bindings || [],
__knexQueryUid: uuid.v4(),
toNative: () => ({
sql: this.client.positionBindings(query.sql),
bindings: this.client.prepBindings(query.bindings)
})
__knexQueryUid: uuid.v4()
};

Object.defineProperties(query, {
toNative: {
value: () => {
return {
sql: this.client.positionBindings(query.sql),
bindings: this.client.prepBindings(query.bindings)
};
},
enumerable: false
}
});

if (isString(val)) {
query.sql = val;
} else {
Expand Down

0 comments on commit 59f6cba

Please sign in to comment.