Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
cratejs
Advanced tools
Readme
An extension to crate-connect, CrateJS will provide you with better methods for working with Crate.io.
npm install cratejs
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,
}
]
*/
});
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) {});
blob().put(table, sha1Hash, buffer, callback)
var buffer = new Buffer('sample')
var hash = crypto.createHash('sha1').update(buffer).digest('hex')
####blob().put('imagesTable', hash, buffer, function(err) {
if(err) {
//err.statusCode
}
})
blob().get(table, sha1Hash, callback)
db.blob().get('imagesTable', '8151325dcdbae9e0ff95f9f9658432dbedfdb209', function(err, buffer) {
if(err) {
//err.statusCode
}
})
blob().check(table, sha1Hash, callback)
db.blob().check('imagesTable', '8151325dcdbae9e0ff95f9f9658432dbedfdb209', function(err) {
if(err) {
//err.statusCode
}
})
blob().delete(table, sha1Hash, callback)
db.blob().check('imagesTable', '8151325dcdbae9e0ff95f9f9658432dbedfdb209', function(err) {
if(err) {
//err.statusCode
}
})
This was created for the Crate.io data Storage.
FAQs
This is a node.js driver for the Crate Data Storage.
The npm package cratejs receives a total of 29 weekly downloads. As such, cratejs popularity was classified as not popular.
We found that cratejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.