2.0.0 • Published 7 years ago
hemera-store v2.0.0
Hemera-store package
Simple API to be interoperable with most database interfaces.
Interface
Provide a unique pattern set for all common api methods. We had to choose for some conventions across document and table oriented stores.
| Table-oriented | Document-oriented | Convention |
|---|---|---|
| Database | Database | Database |
| Collection | Collection | Collection |
create
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executecreatecollection: the name of the table or collectionstringdata: the data which represent the entity to createobjectorArray<object>
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'create',
collection: 'product',
data: {
name: 'tomato'
}
},
function(err, resp) {}
)update
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executeupdatecollection: the name of the table or collectionstringdata: the data which represent the entity to updateobjectquery: the search criteriaobject
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'update',
collection: 'product',
query: {},
data: {
name: 'tomato'
}
},
function(err, resp) {}
)updateById
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executeupdateByIdcollection: the name of the table or collectionstringdata: the data which represent the entity to createobjectid: the primary identifier of your entitystringornumber
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'updateById',
id: 1,
collection: 'product',
data: {
name: 'tomato'
}
},
function(err, resp) {}
)find
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executefindcollection: the name of the table or collectionstringquery: the search criteriaobjectoptions: the search criteriaobject(optional)limit: maximum items to fetchintegeroffset: the offsetintegerorderBy: the offsetarray<string>orstringormap<string, int>fields: the projection settingsarray<string>ormap<string, int>
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'find',
collection: 'product',
query: {}
},
function(err, resp) {}
)findById
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executefindByIdcollection: the name of the table or collectionstringid: the primary identifier of your entitystringornumber
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'findById',
id: 1,
collection: 'product'
},
function(err, resp) {}
)remove
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executeremovecollection: the name of the table or collectionstringquery: the search criteriaobject
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'remove',
collection: 'product',
query: {}
},
function(err, resp) {}
)removeById
The pattern is:
topic: is the topic to publish tosql-storecmd: is the command to executeremoveByIdcollection: the name of the table or collectionstringid: the primary identifier of your entitystringornumber
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'removeById',
id: 1,
collection: 'product'
},
function(err, resp) {}
)replace
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executereplacecollection: the name of the table or collectionstringdata: the data which represent the entity to replaceobjectquery: the search criteriaobject
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'replace',
collection: 'product',
query: {},
data: {
name: 'tomato'
}
},
function(err, resp) {}
)replaceById
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executereplaceByIdcollection: the name of the table or collectionstringdata: the data which represent the entity to updateobjectid: the primary identifier of your entitystringornumber
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'replaceById',
id: 1,
collection: 'product',
data: {
name: 'tomato'
}
},
function(err, resp) {}
)exists
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executeexistscollection: the name of the table or collectionstringquery: the search criteriaobject
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'exists',
collection: 'product',
query: {}
},
function(err, resp) {}
)count
The pattern is:
topic: is the store name to publish to<name>-storecmd: is the command to executecountcollection: the name of the table or collectionstringquery: the search criteriaobject
Example:
hemera.act(
{
topic: 'sql-store',
cmd: 'count',
collection: 'product',
query: {}
},
function(err, resp) {}
)2.0.0
7 years ago
1.1.20
7 years ago
1.1.19
7 years ago
1.1.18
8 years ago
1.1.17
8 years ago
1.1.16
8 years ago
1.1.15
8 years ago
1.1.14
8 years ago
1.1.13
8 years ago
1.1.12
8 years ago
1.1.11
8 years ago
1.1.10
8 years ago
1.1.9
8 years ago
1.1.8
8 years ago
1.1.7
8 years ago
1.1.6
8 years ago
1.1.5
9 years ago
1.1.4
9 years ago
1.1.3
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago