@antelopejs/interface-database
AQL (Antelope Query Language)是"羚羊JS"的数据库-不可知的查询构建者. 您只写过一次可连锁、可键入的查询, 而任何执行接口的数据库模块都会运行它 .
它提供的东西
Schema声明表格、字段和索引。 每个计划可以举办几个孤立的事件.Table, (中文(简体) ),Selection财务报告和审定财务报表SingleSelection插入、读取、更新和删除文档.Stream过滤器,地图,加入,组和集合.ValueProxy构建其中的表达式.changes()串流发生时插入、更新和删除.- 问道懒去. 在你走之前什么也没有
await查询、呼叫.run()或竖起它.
执行情况
| 模块 | 页:1 |
|---|---|
@antelopejs/mongodb | 蒙哥发. 还执行 @antelopejs/interface-mongodb。 。 。 . |
@antelopejs/rethinkdb | 重新思考DB. 还执行 @antelopejs/interface-rethinkdb。 。 。 . |
安装
向运行查询的模块添加接口 :
pnpm add @antelopejs/interface-database
然后在项目中添加一个执行:
ajs project modules add @antelopejs/mongodb
快开始
import { Schema } from "@antelopejs/interface-database";
interface Novel {
_id?: string;
title: string;
pageCount: number;
}
const schema = new Schema<{ novels: Novel }>("library", {
novels: {
fields: { title: "string", pageCount: "number" },
indexes: { pageCount: {} },
},
});
const novels = schema.instance().table("novels");
export async function addNovel(title: string, pageCount: number) {
return await novels.insert({ title, pageCount });
}
export async function listLongNovels() {
return await novels
.filter((novel) => novel.key("pageCount").ge(300))
.orderBy("pageCount", "desc");
}
类似 filter 上文所列收入a ValueProxy,不是文档。 回调一次,当查询构建时,查询只记录 ValueProxy 给它打电话.
文档
兼容性
此软件包已声明 @antelopejs/* 对等依赖 :
| 软件包 | 支助 | 测试过 |
|---|---|---|
@antelopejs/interface-core | >=0.2.4 <1.0.0 | 0.2.4 |
捐款
读取 捐款额 在你打开拉动请求之前。 当地检查为:
pnpm install
pnpm lint
pnpm test