exports.toshihiko.connections is an object that contains one or several
connection configurations. The configuration will combine with default
configuration.
And you can also define a model via default connection by calling
app.toshi.define(). e.g.
const User = app.toshi.define('users', [
...
]);
Types
In package Toshihiko, the types that be used in defining are in
require('toshihiko').Type. Here in egg-toshihiko, you may access types
directly in app.toshi. e.g.
egg-toshihiko
Yet another ORM called Toshihiko plugin for egg.
Installation
Usage & Configuration
config/config.default.js
exports.toshihikomay contain the default configuration of Toshihiko. (refs: http://docs.toshihikojs.com/en/latest/docs/getting-started/#setting-up-a-connection)exports.toshihiko.connectionsis an object that contains one or several connection configurations. The configuration will combine with default configuration.config/plugin.js
Model Files
Please put models under app/model directory.
Defining a Model
When define a model, you should get a toshihiko connection first.
app.toshiorapp.toshihikoequals torequire('toshihiko').Toshihiko.And an extra function
app.toshi.get(CONN_NAME)returns a toshihiko connection with nameCONN_NAME.You may use a connection to define a model. e.g.
And you can also define a model via default connection by calling
app.toshi.define(). e.g.Types
In package Toshihiko, the types that be used in defining are in
require('toshihiko').Type. Here in egg-toshihiko, you may access types directly inapp.toshi. e.g.Example
Define a model first:
Now you can use it in your controller:
Questions & Suggestions
Please open an issue here.
License
MIT