Updated JSdoc for Datasource constructor
This commit is contained in:
parent
82ea32f319
commit
d19001a56e
|
@ -33,11 +33,10 @@ var slice = Array.prototype.slice;
|
|||
|
||||
/**
|
||||
* LoopBack models can manipulate data via the DataSource object.
|
||||
* Attaching a `DataSource` to a `Model` adds instance methods and static methods to the `Model`;
|
||||
* some of the added methods may be remote methods.
|
||||
* Attaching a `DataSource` to a `Model` adds instance methods and static methods to the `Model`.
|
||||
*
|
||||
* Define a data source for persisting models.
|
||||
* Typically, you create a DataSource by calling createDataSource() on the LoopBack object; for example:
|
||||
* Define a data source to persist model data.
|
||||
* To create a DataSource programmatically, call `createDataSource()` on the LoopBack object; for example:
|
||||
* ```js
|
||||
* var oracle = loopback.createDataSource({
|
||||
* connector: 'oracle',
|
||||
|
@ -49,15 +48,10 @@ var slice = Array.prototype.slice;
|
|||
* ```
|
||||
*
|
||||
* All classes in single dataSource share same the connector type and
|
||||
* one database connection. The `settings` argument is an object that can have the following properties:
|
||||
* - host
|
||||
* - port
|
||||
* - username
|
||||
* - password
|
||||
* - database
|
||||
* - debug (Boolean, default is false)
|
||||
* one database connection.
|
||||
*
|
||||
* For example, the following creates a DataSource, and waits for a connection callback.
|
||||
*
|
||||
* @desc For example, the following creates a DataSource, and waits for a connection callback.
|
||||
* ```
|
||||
* var dataSource = new DataSource('mysql', { database: 'myapp_test' });
|
||||
* dataSource.define(...);
|
||||
|
@ -66,8 +60,21 @@ var slice = Array.prototype.slice;
|
|||
* });
|
||||
* ```
|
||||
* @class DataSource
|
||||
* @param {String} name Type of dataSource connector (mysql, mongoose, oracle, redis)
|
||||
* @param {Object} settings Database-specific settings to establish connection (settings depend on specific connector). See above.
|
||||
* @param {String} [name] Optional name for datasource.
|
||||
* @options {Object} settings Database-specific settings to establish connection (settings depend on specific connector).
|
||||
* The table below lists a typical set for a relational database.
|
||||
* @property {String} connector Database connector to use. For any supported connector, can be any of:
|
||||
*
|
||||
* - The connector module from `require(connectorName)`.
|
||||
* - The full name of the connector module, such as 'loopback-connector-oracle'.
|
||||
* - The short name of the connector module, such as 'oracle'.
|
||||
* - A local module under `./connectors/` folder.
|
||||
* @property {String} host Database server host name.
|
||||
* @property {String} port Database server port number.
|
||||
* @property {String} username Database user name.
|
||||
* @property {String} password Database password.
|
||||
* @property {String} database Name of the database to use.
|
||||
* @property {Boolean} debug Display debugging information. Default is false.
|
||||
*/
|
||||
function DataSource(name, settings, modelBuilder) {
|
||||
if (!(this instanceof DataSource)) {
|
||||
|
@ -2097,4 +2104,3 @@ DataSource.Any = ModelBuilder.Any;
|
|||
DataSource.registerType = function (type) {
|
||||
ModelBuilder.registerType(type);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue