Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jnterry committed Jan 26, 2018
1 parent 1b53827 commit cc625c9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nano-orm.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ function defineModel(table_name, model_fields, options){
}
}

// Define this.id field as a proxy for the internal this._fields.id field
// This can be 'got' only (IE: no set).
// It is set automatically when the instance is saved to the database
// and can't be modified else we may insert new instances/overwrite other
// instances when calling .save()
Object.defineProperty(this, 'id', {
configurable : false,
enumerable : true,
Expand All @@ -212,6 +217,8 @@ function defineModel(table_name, model_fields, options){
},
});

// And define the rest of the field accessors,
// also proxies for the internal this._fields.xxx
for(let field of model_fields) {
Object.defineProperty(this, field, {
configurable : false,
Expand Down

0 comments on commit cc625c9

Please sign in to comment.