Page MenuHomeSealhub

field-type.js
No OneTemporary

field-type.js

var Promise = require("bluebird");
var merge = require("merge");
/**
* Stores field type metadata, as well as validation methods
* @class
*/
function FieldType(name){
this.longid = longid;
Sealious.ChipManager.add_chip("resource_type", this.name, this, parent_module_path);
}
FieldType.prototype = new function(){
/**
* Whether a given value can be stored in this field type instance
* @memberOf FieldType
* @abstract
* @param {any} value value of this variable will be tested for compatibility with this field
* @return {Promise}
*/
this.isProperValue = function(value){
return new Promise(function(resolve, reject){
resolve(value);
});
}
this.encode = function(value_in_code){
return new Promise(function(resolve, reject){
resolve(value_in_code);
})
}
this.decode = function(value_in_database){
return new Promise(function(resolve, reject){
resolve(value_in_database);
})
}
this.setParams = function(param_map){
if(this.params==undefined){
this.params = param_map;
}
this.params = merge(this.params, param_map);
}
}
FieldType.is_a_constructor = true;
FieldType.type_name = "field_type";
module.exports = FieldType;

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 8, 02:35 (14 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1033930
Default Alt Text
field-type.js (1 KB)

Event Timeline