Class moose.plugins.TimeStampPlugin
Time stamp plugin to support creating timestamp
Defined in: timestamp.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
moose.plugins.TimeStampPlugin.timestamp(options)
Adds timestamp functionality to a table.
|
Class Detail
moose.plugins.TimeStampPlugin()
//create your model and register the plugin. var MyModel = moose.addModel("testTable", { plugins : [moose.plugins.TimeStampPlugin]; }); //initialize default timestamp functionality MyModel.timestamp(); //Or //initialize custom update column MyModel.timestamp({updated : "myUpdateColumn"}); //Or //initialize custom created column MyModel.timestamp({created : "myCreatedColumn"}); //Or //Set to update the updated column when row is created MyModel.timestamp({updateOnCreate : true}); //Or //Set both custom columns MyModel.timestamp({updated : "myUpdateColumn", created : "myCreatedColumn"}); //Or //Use all three options! MyModel.timestamp({ updated : "myUpdateColumn", created : "myCreatedColumn", updateOnCreate : true });
Method Detail
<static>
moose.plugins.TimeStampPlugin.timestamp(options)
Adds timestamp functionality to a table.
- Parameters:
- {Object} options Optional
- {String} options.updated Optional, Default: "updated"
- the name of the column to set the updated timestamp on.
- {String} options.created Optional, Default: "created"
- the name of the column to set the created timestamp on
- {Boolean} options.updateOnCreate Optional, Default: false
- Set to true to set the updated column on creation