Coder Social home page Coder Social logo

minapp-fetch's Introduction

知晓云常用接口封装(js跨平台)

知晓云让后台开发变得更简单,我们让知晓云开发变得更简单。

npm install minapp-fetch

适合:
运营后台云函数小程序WebRNTarouni-app等js开发的

使用:

const minapp = require('minapp-fetch').init('weapp')
minapp.find().then(res => {}, err => {})

文档

最新接口文档,可在minapp-fetch文档里查看

优点

  1. 跨平台性:js平台写法一致,一处写,处处用(个别接口除外)
  2. 调用简单:简化官方复杂的概念,查错、修改更加方便
  3. 方法丰富:除官方的方法外,还增加了许多其他实用方法
  4. 语法提示:支持语法提示

下面就以最简单的and、or复杂组合查寻为例:

/** 原方法 **/
let query1 = new wx.BaaS.Query()
query1.in('color', ['green', 'red', 'yellow'])
let query2 = new wx.BaaS.Query()
query2.compare('price', '>', 10)
let andQuery = wx.BaaS.Query.and(query1, query2)
let query3 = new wx.BaaS.Query()
query3.compare('amount', '>=', 3)
let orQuery = wx.BaaS.Query.or(andQuery, query3)
let Product = new wx.BaaS.TableObject(tableName)
Product.setQuery(orQuery).find().then(res => {
  // success
})


/** minapp-fetch 各个平台写法都如下 **/
minapp.find(tableName, {
  p1: ['color', 'in', ['green', 'red', 'yellow']],
  p2: ['price', '>', 10],
  p3: ['amount', '>=', 3],
  r: '(p1 && p2) || p3'
}).then(res => {
  // success
})

更新日志

还有部分官方接口没有跟进,我们会一直完善的~

v2.1.0

  • 加入字节跳动小程序的支持。

v2.0.2

  • 新增查寻类方法stringLength,查寻字符串长度。
  • p0: ['title', 'stringLength', 5]查寻title长度为5的内容。
  • p0: ['title', 'stringLength', 5, 20]查寻title长度为5~20的内容。
  • 其他优化。

v2.0.1

  • 新增获取异步任务结果的方法getAsyncJobResult
  • 更新官方sdk到3.8.0

v2.0.0

  • typescript重写minapp-fetch包,现在支持语法提示,让开发更高效。
  • upload方法参数统一命名,pay方法优化
  • 修改部分用户操作相关方法的bug
  • 其他问题修复
  • 引入方式统一改成const minapp = require('minapp-fetch').init('default'),且平台必须选择,default为默认平台(即以前的不加任何平台)

minapp-fetch's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.