@reldens/storage
v0.31.0
Published
Reldens - Storage
Downloads
151
Maintainers
Readme
Reldens - Storage
About this package
This package is designed to provide a standard drivers support for managing Reldens project data.
This way in any Reldens project we can trust that any driver implementation will have the exact same methods available to fetch and manage the project entities.
Every time you need to load, create, update or delete data in Reldens, the drivers from this package will be used.
Current features
The package currently has drivers to support two ORMs:
- Objection JS (with Knex), for everything that's SQL related (this is our base and recommended package).
let server = new ObjectionJsDataServer({
client: 'mysql',
config: {
user: 'reldens',
password: 'reldens',
database: 'reldens',
port : 3306,
}
});
- Mikro-ORM, to offer support for nonSQL/MongoDB (this package is not finished, if you like to use it please contact us).
let server = new MikroOrmDataServer({
client: 'mongodb',
config: {
user: 'reldens',
password: 'reldens',
database: 'test',
port : 27017,
},
connectStringOptions: 'authSource=reldens&readPreference=primary&appname=MongoDB%20Compass&ssl=false',
autoGenerateEntities: false,
rawEntities: Object.values(rawRegisteredEntities)
});
Custom drivers
Through this package you can also create your own drivers (to support your own storage system) and later implement it on any Reldens project.
In order to do this, just extend the BaseDataServer and BaseDriver classes and fill all the required methods.
For last, on your Reldens implementation you just need to pass an instance of your data server to the server manager and you are done:
const appServer = new ServerManager(serverConfig, eventsManager, yourDriverInstance);
You can also check the skeleton implementation to see how it works.
For reference see Reldens GitHub: https://github.com/damian-pastorini/reldens/tree/master