title: Is there a way to encode data before insert/update in sequelize?
body: <p>All, Have questions in sequelize. We have a requirement to encode data in the model before insert/update. Below is a one of the columns in the model where some validations are being performed before inserting the data. Also, validateFields.encodeFormData is a function that uses javascript's <code>encodeURIComponent</code> to encode the passed string. So we wanted to know from the experts out there if this is the correct way to encode data or if there any better ways within sequelize to encode and decode?</p>
  
  <p>fyi, SQL server is our db.</p>
  
  <p>Thanks in advance for your help.</p>
  
  <pre><code>Name: {
    type: DataTypes.STRING,
    allowNull: false,
    validate: {
        min: {
            args: 3,
            msg: 'Name must be at least 3 characters'
        },
        max: {
            args: 40,
            msg: 'Name must start with a letter, and be at less than 40 characters.'
        },
        is: {
            args: /['~!@#$^*()_|+\=?;:",&lt;&gt;\{\}\[\]\\\/]/gi,
            msg: 'Invalid Characters detected. Please enter valid characters.'
        }
    },
  
    set:function(val) {
        var encodedVal = validateFields.encodeFormData(val);
        console.log("Encoded name : ", encodedVal);
        this.setDataValue('Name', encodedVal);
    },
  
    get:function() {
        var decodedVal = validateFields.decodeFormData(this.getDataValue('Name'));
        return decodedVal;
    }
  },
  </code></pre>