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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ioa/mmc

v10.0.1

Published

数据库模型的中间件、控制器扩展组件

Downloads

9

Readme

@ioa/mmc

路由模型组件,集成模型、字段、数据类型校验的REST API。

在api开发过程中,经常需要向客户端提供一些纯数据库操作的CRUD接口,这些接口的共同特征是除访问权限外的其它业务逻辑几乎是相同的。为了避免编写重复的接口代码,减少接口数量,@ioa/mmc通过在数据模型与用户api之间加入权限控制中间件,实现安全、快捷的抽象api。

api设计借鉴于postgrest简约的url查询表达式,@ioa/mmc废除了原来臃肿的json方案,使用更为扁平化、更简洁、更易于读写的函数表达式替换。

查询示例

select

http://localhost:80/user?select=title,age,name

select! 反选

http://localhost:80/user?select!=title,age,name

where

http://localhost:80/user?where=name.eq(Wilburn);email.eq([email protected])|age.eq(94580)

逻辑分隔符

“;”字段分隔符

用于隔离多个字段,字段之间是and关系

where=name.eq(Wilburn);email.eq([email protected])

“|”字段分隔符

竖线表示逻辑or,匹配多个条件中的一个即可

name.eq(a)|name.eq(b)

ormv库运算符

@ioa/mmc支持ormv中的所有运算符

参考链接:https://github.com/xiangle/ormv

编码转换

由于url参数存在保留关键字限制,当输入参数值中包含类似于&=()的保留关键字时需要使用encodeURIComponent()进行编码转换

(:%28

):%29

示例

// 错误,赋值中包含非法的保留字()
http://localhost:80/user?where=phone.eq((559)-150-5961)

// 正确,()被转换为对应的url编码
http://localhost:80/user?where=phone.eq(%28559%29-150-5961)

query查询参数

支持Ormv中的所有运算符和查询语句。除此之外@ioa/mmc还扩展了一部分专用选项,用于简化查询语句。

通用参数

  • where 逻辑条件过滤表达式

查列表可用参数

  • select 选择字段,select=name,title,email

  • select! 反选字段,select!=uid,password

  • order 限定排序条件,order=name.desc;title.desc;

  • page 限定当前第几页

  • limit 限制单页最大返回条数,为了防止单次返回数据量过大,默认最多返回100条数据(需要注意的是隐性默认值容易让人产生误判,当实际数据量超过100条时可能会误以为只有100条数据)

  • count 是否显示总量

查详情可用参数

  • select 选择字段,select=name,title,email

  • select! 反选字段,select!=uid,password