Skip to content

Instantly share code, notes, and snippets.

@mathisonian
Created September 17, 2014 17:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mathisonian/bc551d519b3b90f99778 to your computer and use it in GitHub Desktop.
Save mathisonian/bc551d519b3b90f99778 to your computer and use it in GitHub Desktop.
mimicking an array data type with sequelize.js
var MyModel = sequelize.define('MyModel', {
myArrayField: {
type: DataTypes.STRING,
get: function() {
return JSON.parse(this.getDataValue('myArrayField'));
},
set: function(val) {
return this.setDataValue('myArrayField', JSON.stringify(val));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment