You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I've gone through and experimented with setting up a sqlite datasource by @coderintherye, and one thing that I was struggling with is a way to initialize the same datasource into different entityLoaders. For example, currently if you wanted to use the same sqlite datasource for players and accounts, you'd have to write two separate datasources(with their own constructors)...or put your initialize calls into the fetch/update functions which doesn't seem ideal.
The init() function needs to be separate from the constructor, because the constructor is called when the datasource is created, not when the entityLoader is created.
I added a few lines of code into EntityLoader.js to allow each EntityLoader to make a call to an init() function in the datasource which would obliviate this need.
you could add this method and call it in the constructor
Sorry about the late response to this -- this makes sense to me so far, though I'm going to take a look at the SQLite data source as well. Definitely take a swing at it, esp. since your solution seems like it would be backwards compatible with other datasources.
So I've gone through and experimented with setting up a sqlite datasource by @coderintherye, and one thing that I was struggling with is a way to initialize the same datasource into different entityLoaders. For example, currently if you wanted to use the same sqlite datasource for players and accounts, you'd have to write two separate datasources(with their own constructors)...or put your initialize calls into the fetch/update functions which doesn't seem ideal.
The init() function needs to be separate from the constructor, because the constructor is called when the datasource is created, not when the entityLoader is created.
I added a few lines of code into EntityLoader.js to allow each EntityLoader to make a call to an init() function in the datasource which would obliviate this need.
you could add this method and call it in the constructor
Then all you need is an init() method in the DataSource that takes in the entityloader config and initializes the database / tables as needed.
The text was updated successfully, but these errors were encountered: