This repository has been archived by the owner on Oct 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Create a connector
Guillaume Daix edited this page Jan 18, 2018
·
6 revisions
Connector are used to bind ilorm to a new database or storage.
You can create connector to link database, system file, SaaS system, an API, anything. A connector is a specific kind of plugin.
# How connector work Connector are a specific kind of plugin. A connector need to have a Class "Connector" which implement required method to work.
The connector class is instantied when you bind the model with your database. You can imagine having one Connector instance per model used in a project. You can use the constructor to bind specific database connection or database collection (MongoDB) or table (SQL type) or a file (CSV database)...
name | description |
---|---|
create(docs ) |
Create docs into the database |
find(query ) |
Retrieve multiple docs from the database with the given query |
findOne(query ) |
Retrieve one doc frome the database with the given query |
count(query ) |
Count number of docs which match the query |
update({query, update} ) |
Update multiple docs from the database with the given query |
updateOne({query, update} ) |
Update one doc frome the database with the given query |
remove(query ) |
Remove multiple docs from the database with the given query |
removeOne(query ) |
Remove one doc frome the database with the given query |
stream(query ) |
Get a stream of document which match the query |
modelFactory({ParentModel} ) |
Create a Model matching the Connector |
queryFactory({ParentQuery} ) |
Create a Query matching the Connector |