Closed lbguilherme closed 6 years ago
I think in some thing like a DatabaseInterface
.
The user can make your own DatabaseInterface
and pass it to api
. If nothing is provided the api
will use the default implementation using rethinkdb.
export interface DatabaseInterface {
loadData(params: any) => Promise<any>;
saveData(obj: any) => Promise<any>;
etc...
}
export defineDatabaseImplementation(db: DatabaseInterface) {
...
}
By default the sdkgen will generate api code that uses RethinkDB for
But you can specify the option $useRethink = false
to generate nothing related to the database and implement those 3 functions with working "no op"s.
The above functions can still be implemented with the exposed api.hooks.
I'm closing this issue as fixed.
Fate of
api_calls
need to be decided. Maybe we can have database plugins.