nv-lean-fetch

nv-lean-fetch ============ - fetch lean-cloud remote database

Usage no npm install needed!

<script type="module">
  import nvLeanFetch from 'https://cdn.skypack.dev/nv-lean-fetch';
</script>

README

nv-lean-fetch

  • fetch lean-cloud remote database

install

  • npm install nv-lean-fetch

usage

examples:

const {sync_av_init,lean_fetch} = require("nv-lean-fetch");
const AV = require('leancloud-storage');

const { Query, User } = AV;
const appId = "xxxxx"
const appKey =  "xxxxx"
const serverURL = "https://xxxxx"


sync_av_init(AV,appId,appKey,serverURL);


var p = lean_fetch(AV,'gps_info',450,100);
p.then(r=>{console.log(r.args.rslt.length)})

results

> it
{
  each_tmout: 5000,
  total_tmout: 30000,
  limit: 100,
  si: 450,
  real_count: 100,
  next_expected_count: 0,
  total: 450,
  lefted: 0,
  rslt: [....]
}
>
var rslt=[]
p.then(it=>{rslt = it.args.rslt});
> rslt.map(e=>e.attributes)
[
  {
    img_id: '5ccd76a60237d7006f261e80',
    exif_id: '5ccd76a80237d7006f261e89',
    gps_id: '5ccd76a8d3761600694d5579'
  },
  {
    img_id: '5ccd77b6ba39c80070d65e75',
    exif_id: '5ccd77b7d3761600694d60a7',
    gps_id: '5ccd77b7ba39c80070d65e84'
  },
  {
    img_id: '5ccd77cba91c930068c2a1f6',
    exif_id: '5ccd77cc17b54d0068cc412f',
    gps_id: '5ccd77cdd5de2b0074f9dfbb'
  },
  ....
]

LICENSE

  • ISC