Package Exports
- cratejs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cratejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CrateJS
- Under development, CrateJS was moved to crate-connect, use it for now.
An extension to crate-connect, CrateJS will provide you with better methods for working with Crate.io.
Installation
npm install cratejsConnecting
var Crate = require('cratejs');
//You can have as many db instance as you please :)
//You should probably add this part to another module and export it!
var db = module.exports = new Crate({
host: 'localhost',
port: 4200,
/* Optional manual clustering
cluster: [
{
host: '192.168.0.100',
port: 4200,
}
]
*/
});- The "db" variable will be used in the examples below.
Sample docs
db.Select(tableName)
var findBars = db.Select('fooTable')
.columns(['id', 'name', 'bar'])
.where({
bar: 1
})
.limit(1)
.order('id', 'asc');
findBars.run(function(err, res) {});db.Insert(tableName)
var insertBars = db.Insert('fooTable');
//Inserting a single row
insertBars.data({
bar: 1
}).run(function(err, res) {});
//Inserting multiple rows
insertBars.data([
{
bar: 1
},
{
bar: 2
},
]).run(function(err, res) {});db.Update(tableName)
var updateBars = db.Update('fooTable')
.where({
bar: 1
})
.set({
bar: 2
});
updateBars.run(function(err, res) {});db.Delete(tableName)
var deleteBars = db.Delete('fooTable')
.wh11g10ggere({
bar: 1
});
deleteBars.run(function(err, res) {});db.Query(_queryString)
var getSomeTweets = db.Query('SELECT * FROM tweets LIMIT ?');
var howMany = 10;
getSomeTweets.execute([howMany], function(err, res) {});db.execute(_queryString)
db.execute('SELECT * FROM tweets LIMIT ?', [10], function(err, response) {});TODO
- Blobs
- Schema constructor
- Indexing helpers
- Shards and replicas helper
Authors
This was created for the Crate.io data Storage.
Thanks to
Nobody yet :(