Wrap README.md at 78 characters where possible
This commit is contained in:
parent
a3d66b65ef
commit
32fbc1aa9f
40
README.md
40
README.md
|
@ -1,7 +1,8 @@
|
||||||
# LoopBack DataSource Juggler
|
# LoopBack DataSource Juggler
|
||||||
|
|
||||||
LoopBack DataSource Juggler is an ORM that provides a common set of interfaces for interacting with databases, REST APIs,
|
LoopBack DataSource Juggler is an ORM that provides a common set of interfaces
|
||||||
and other data sources. It was initially forked from [JugglingDB](https://github.com/1602/jugglingdb).
|
for interacting with databases, REST APIs, and other data sources. It was
|
||||||
|
initially forked from [JugglingDB](https://github.com/1602/jugglingdb).
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
|
@ -15,12 +16,12 @@ LoopBack DataSource Juggler consists of the following components:
|
||||||
|
|
||||||
## LoopBack Definition Language
|
## LoopBack Definition Language
|
||||||
|
|
||||||
To define model dataSource have single method `dataSource.define`. It accepts three
|
To define model dataSource have single method `dataSource.define`. It accepts
|
||||||
arguments:
|
three arguments:
|
||||||
|
|
||||||
* **model name**:
|
* **model name**:
|
||||||
String name in camel-case with first upper-case letter. This name will be used
|
String name in camel-case with first upper-case letter. This name will be
|
||||||
later to access model.
|
used later to access model.
|
||||||
* **properties**:
|
* **properties**:
|
||||||
Object with property type definitions. Key is property name, value is type
|
Object with property type definitions. Key is property name, value is type
|
||||||
definition. Type definition can be function representing type of property
|
definition. Type definition can be function representing type of property
|
||||||
|
@ -53,12 +54,12 @@ Examples of model definition:
|
||||||
|
|
||||||
## DataSource
|
## DataSource
|
||||||
|
|
||||||
DataSource is a factory for model classes. DataSource connected with specific database or other
|
DataSource is a factory for model classes. DataSource connected with specific
|
||||||
backend system using connector.
|
database or other backend system using connector.
|
||||||
|
|
||||||
All model classes within single datasource shares same connector type and one database
|
All model classes within single datasource shares same connector type and one
|
||||||
connection. But it's possible to use more than one datasource to connect with
|
database connection. But it's possible to use more than one datasource to
|
||||||
different databases.
|
connect with different databases.
|
||||||
|
|
||||||
### Creating dataSource
|
### Creating dataSource
|
||||||
|
|
||||||
|
@ -66,8 +67,8 @@ different databases.
|
||||||
|
|
||||||
var DataSource = require('loopback-datasource-juggler').DataSource;
|
var DataSource = require('loopback-datasource-juggler').DataSource;
|
||||||
|
|
||||||
DataSource constructor accepts two arguments. First argument is connector. It could be
|
DataSource constructor accepts two arguments. First argument is connector. It
|
||||||
connector name or connector package:
|
could be a connector name or connector package:
|
||||||
|
|
||||||
var dataSourceByConnectorName = new DataSource('memory');
|
var dataSourceByConnectorName = new DataSource('memory');
|
||||||
var dataSourceByConnectorModule = new DataSource(require('redis'));
|
var dataSourceByConnectorModule = new DataSource(require('redis'));
|
||||||
|
@ -95,9 +96,9 @@ For connector-specific settings refer to connector's readme file.
|
||||||
| MySQL | [loopback-connector-mysql](https://github.com/strongloop/loopback-connector-mysql) |
|
| MySQL | [loopback-connector-mysql](https://github.com/strongloop/loopback-connector-mysql) |
|
||||||
|
|
||||||
|
|
||||||
LoopBack connectors provide access to backend systems including databases, REST APIs
|
LoopBack connectors provide access to backend systems including databases,
|
||||||
and other services. Connectors are not used directly by application code. We create
|
REST APIs and other services. Connectors are not used directly by application
|
||||||
a DataSource to interact with the connector.
|
code. We create a DataSource to interact with the connector.
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
|
|
||||||
|
@ -112,11 +113,13 @@ For example,
|
||||||
debug : true
|
debug : true
|
||||||
});
|
});
|
||||||
|
|
||||||
The connector argument passed the DataSource constructor can be one of the following:
|
The connector argument passed the DataSource constructor can be one of the
|
||||||
|
following:
|
||||||
|
|
||||||
* The connector module from `require(connectorName)`
|
* The connector module from `require(connectorName)`
|
||||||
* The full name of the connector module, such as 'loopback-connector-oracle'
|
* The full name of the connector module, such as 'loopback-connector-oracle'
|
||||||
* The short name of the connector module, such as 'oracle', which will be converted to 'loopback-connector-<shortName>'
|
* The short name of the connector module, such as 'oracle', which will be
|
||||||
|
converted to 'loopback-connector-<shortName>'
|
||||||
* A local module under ./connectors/<connectorName> folder
|
* A local module under ./connectors/<connectorName> folder
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,4 +134,3 @@ Also install the appropriated connector, for example for mongodb:
|
||||||
check following list of available connectors
|
check following list of available connectors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue