@scorpionknifes/fireo
Version:
Fork of Fireo, Google Cloud Firestore modern and simplest convenient ORM package in NodeJs. FireO is specifically designed for the Google's Firestore
48 lines (42 loc) • 799 B
JavaScript
/**
* Field for Firestore document id
*/
class IDField {
/**
* @constructor
*/
constructor() {
this.val;
this.originalName;
this.modelName;
}
/**
* configure the ID field
* @param {string} originalName - Field name
* @param {string} modelName - Name if the model
*/
configure(config = { originalName, modelName }) {
this.originalName = config.originalName;
this.modelName = config.modelName;
}
/**
* get field name
*/
get name() {
return this.originalName;
}
/**
* Get value
*/
get getValue() {
return this.val;
}
/**
* set id value
* @param {string} value - custom id value
*/
setValue(value) {
this.val = value;
}
}
module.exports = IDField;