Wondering what‚Äôs next for npm?Check out our public roadmap! ¬Ľ

    co-aerospike

    0.1.0¬†‚Äʬ†Public¬†‚Äʬ†Published

    co-aerospike

    Usage

    const Aerospike = require('aerospike');
    const coAerospike = require('co-aerospike');
     
    const client = Aerospike.connect({
      hosts: 'aerospike-dev.s.qima-inc.com'
    });
     
    coAerospike.client(client);
     
    let key = new Key('test', 'co-aerospike', '1');
     
    client.put(key, {a: 1})
      .then(()=>{
        return client.get(key)
      })
      .then((res)=>{
        console.log(res.a);
      })
      .then(()=>{
        client.put(key, {b: 1}, function(err) {
          if (err) throw err;
        });   //compatible with callback,but will not return promise
      })

    Set promise

    const coAerospike = require('co-aerospike');
    const Promise = require('bluebird');
     
    coAerospike.Promise = Promise;
     
    // client.get(key) instanceof Promise;

    Sync function

    Some method of client is sync, doesn't need callback ['LargeList', 'close', 'info', 'isConnected', 'query', 'scan', 'sendError', 'updateLogging'] Those method will not be promisify

    Install

    npm i co-aerospike

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    ISC

    Last publish

    Collaborators

    • avatar