react-native-db-models icon indicating copy to clipboard operation
react-native-db-models copied to clipboard

Not issue, suggestion

Open getreup opened this issue 10 years ago • 1 comments
trafficstars

Hey darkrishabh,

No issue, just wanted to suggest maybe making a lazy table creator in your DB.js, like so:

var RNDBModel = require('react-native-db-models')
var DB = {
    table : function(tableName)
    {
      if( typeof DB[tableName] === 'undefined' ) DB[tableName] = new RNDBModel.create_db(tableName);

      return DB[tableName];
    },
}
module.exports = DB

Is there a foreseeable issue with this method?

The advantage is that if you have dynamic code that may add new data structures at any time, you can let that happen.

Thanks,

Kelsey

getreup avatar Oct 27 '15 00:10 getreup

Its funny, because I currently have an extended API called initDB that I have been using personally which does the similar task. I will integrate it soon. Thanks @KelseyRegan

darkrishabh avatar Nov 23 '15 21:11 darkrishabh