npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

query-orm-client

v0.0.8

Published

query-orm-client

Downloads

6

Readme

简介

url 语义化,自定义查询结果,去除重复数据,节省流量提高速度。 提高开发效率

详细文档

安装

通过 npm 安装 在现有项目中使用 QueryOrmClient 时,可以通过 npm进行安装:

npm i query-orm-client

通过 script 标签方式引入 使用 QueryOrmClient 最简单的方法是直接在 html 文件中引入 之后你可以通过全局变量 queryOrmClient 访问。

   <script src="query-orm-client.umd.js" ></script>

使用案例

npm 模式使用

  import QueryOrmClient from 'query-orm-client'
  let queryOrm=new QueryOrmClient();

或通过 script 标签方式引入

  let queryOrm=new queryOrmClient();

表达式查询的用法示例如下:

= :等于

例如:

queryOrm.where('id','=',100).toUriQueryString();
或者
queryOrm.where('id',100).toUriQueryString();

生成url为

url?filter[id{eq}]=100 

表示的查询条件是 id = 100

!=或<> :不等于

例如:

queryOrm.where('id','<>',100).toUriQueryString();

生成url为

url?filter[id{neq}]=100 

表示的查询条件就是 id != 100

> :大于

例如:

queryOrm.where('id','>',100).toUriQueryString();

生成url为

url?filter[id{gt}]=100 

表示的查询条件就是 id > 100

>= :大于等于

例如:

queryOrm.where('id','>=',100).toUriQueryString();

生成url为

url?filter[id{egt}]=100 

表示的查询条件就是 id >= 100

< :小于

例如:

queryOrm.where('id','<',100).toUriQueryString();

生成url为

url?filter[id{lt}]=100 

表示的查询条件就是 id < 100

<= :小于等于

例如:

queryOrm.where('id','<=',100).toUriQueryString();

生成url为

url?filter[id{elt}]=100 

表示的查询条件就是 id <= 100

like :同sql的LIKE

例如:

queryOrm.where('id','like','张三%').toUriQueryString();

生成url为

url?filter[id{like}]=张三% 

in :查询 id为1,2,3 的数据

例如:

queryOrm.where('id','in','1,2,3').toUriQueryString();
queryOrm.where('id','in',['1,2,3']).toUriQueryString();
或
queryOrm.whereIn('id','1,2,3').toUriQueryString();
queryOrm.whereIn('id',['1,2,3']).toUriQueryString();

生成url为

url?filter[id{in}]=1,2,3 

between :查询 id为1到8 的数据

例如:

queryOrm.where('id','between','1,8').toUriQueryString();
或
queryOrm.whereBetween('id','between','1,8').toUriQueryString();

服务端会解析成

url?filter[id{between}]=1,8 

多字段,多条件组合使用


queryOrm.where('age',1).where('age','<',50).where('sex','<>',20).toUriQueryString();

生成url为

url?filter[type{eq}]=1&filter[age{lt}]=50&filter[sex{neq}]=2

表示的查询条件是 type=1 并且 age<50 并且 sex!=2

移除某条件


queryOrm.removeWhere('age')

字段过滤


| 参数名 | 描述 | | ------------------------------ | ---------------- | | select | 显示的字段以逗号相隔 |

用法示例如下:

queryOrm.select(['id','date','content']).toUriQueryString();

生成url为

url?select=id,date,content

表示的是只显示id,date,content 字段

字段别名


如果想要使用字段的别名可以这样写:

queryOrm.select(['id','date','content:text']).toUriQueryString();

生成url为

url?select=id,date,content:text

表示的是只显示id,date,text 字段

排序


  1. 单字段排序

| 参数名 | 描述 | | ------------------------------ | ---------------- | | order_by | 排序字段 | | sorted_by | 排序方式 默认就是升序排列 | 用法示例如下:

queryOrm.orderBy('id').toUriQueryString();
或者
queryOrm.orderBy('id','desc').toUriQueryString();

生成url为

url?order_by=id&sorted_by=desc

表示的是根据id降序排序

  1. 多字段排序
queryOrm.orderBy('id').orderBy('type','asc').toUriQueryString();
或者
queryOrm.orderBy('id').orderBy('type','asc').toUriQueryString();

生成url为

url?order_by=id,type&sorted_by=desc,asc

分页


| 参数名 | 描述 | | ------------------------------ | ---------------- | | page | 页码,从1开始 | | page_size | 每页几条数据 默认15 |

queryOrm.page(1,15).toUriQueryString();

生成url为

url?page=1&page_size=15

注意事项

  1. 生成的url 默认已经encodeURI编码 如果不需要编码 toUriQueryString(false)

技术服务与支持

没有资金的支撑就很难得到发展,特别是一个好的产品,如果 QueryOrmClient 帮助了您,请为我们点赞。支持我们,您可以得到一些回报,有了这些我们会把公益事业做的更好,回报社区和社会,请给我们一些动力吧,在此非常感谢已支持我们的朋友!