81 lines
1.2 KiB
JavaScript
81 lines
1.2 KiB
JavaScript
|
|
var ModelIface = require('./object');
|
|
|
|
/**
|
|
* Monitorizes all changes made to a model.
|
|
*/
|
|
var Klass = new Class();
|
|
module.exports = Klass;
|
|
|
|
var Mode = {
|
|
ON_CHANGE : 1
|
|
,ON_DEMAND : 2
|
|
};
|
|
|
|
var Operation = {
|
|
INSERT : 1 << 1
|
|
,UPDATE : 1 << 2
|
|
,DELETE : 1 << 3
|
|
};
|
|
|
|
Klass.extend({
|
|
Mode: Mode
|
|
,Operation: Operation
|
|
});
|
|
|
|
Klass.implement({
|
|
Implements: ModelIface
|
|
,Properties: {
|
|
/**
|
|
* Update mode.
|
|
*/
|
|
mode: {
|
|
enumType: Mode
|
|
,value: Mode.ON_CHANGE
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Updates a value on the model.
|
|
*
|
|
* @param {number} rowIndex The row index
|
|
* @param {string} columnName The column name
|
|
* @param {*} value The new value
|
|
*/
|
|
,set() {}
|
|
|
|
/**
|
|
* Updates a value on the model using the column index.
|
|
*
|
|
* @param {number} rowIndex The row index
|
|
* @param {number} col The column index
|
|
* @param {*} value The new value
|
|
*/
|
|
,setByIndex() {}
|
|
|
|
/**
|
|
* Deletes a row from the model.
|
|
*
|
|
* @param {number} rowIndex The row index
|
|
*/
|
|
,deleteRow() {}
|
|
|
|
/**
|
|
* Inserts a new row on the model.
|
|
*
|
|
* @return The index of the inserted row
|
|
*/
|
|
,insertRow() {}
|
|
|
|
/**
|
|
* Cleans the model data.
|
|
*/
|
|
,clean() {}
|
|
|
|
/**
|
|
* Performs all model changes on the database.
|
|
*/
|
|
,performOperations() {}
|
|
});
|
|
|