dflourusso / expo-sqlite-orm

Expo SQLite ORM
132 stars 34 forks source link

Int with value=0 is mapping to null #9

Closed BartRuSec closed 4 years ago

BartRuSec commented 5 years ago

The problem is in BaseModel:

setProperties(props) {
    const cm = this.constructor.columnMapping
    Object.keys(cm).forEach(k => {
      if (props[k]) { //<- this evaluates to false for any {key:0}
        this[k] = props[k]
      } else if (isFunction(cm[k].default)) {
        this[k] = cm[k].default()
      } else {
        this[k] = null
      }
    })
    return this
  }

`

dflourusso commented 4 years ago

Hi, thanks for contribution, it was fixed in v1.4.2.