Linquest: 基于 Jinqu 的 TypeScript 远程 Linq 实现

Linquest 是一个完全使用 TypeScript 编写的远程 Linq 实现,它基于 Jinqu 基础架构。

安装

使用 npm 安装 linquest:

npm install linquest

使用

以下是如何使用 Linquest 的示例:

import { LinqService } from 'linquest';

// 首先,创建一个服务
const service = new LinqService('https://my.company.service.com/');

// 然后创建一个查询
const query = service.createQuery('Companies');

// 执行查询
const result = await query.where(p => p.Id > 5).toArrayAsync();

请求提供者

Linquest 默认使用浏览器内置的 fetch API 进行网络请求。您可能需要使用自定义请求提供程序,例如 Axios 或 jQuery AJAX。

要使用自定义请求提供程序,您需要实现 IAjaxProvider 接口:

import { IAjaxProvider, AjaxOptions } from 'jinqu';

// 实现 IAjaxProvider 接口
class MyAjaxProvider implements IAjaxProvider {
  // ...
}

然后,在创建 LinqService 实例时传入您的自定义提供程序:

const service = new LinqService('https://my.company.service.com/', new MyAjaxProvider());
zip
linquest-master.zip 预估大小:25个文件
folder
linquest-master 文件夹
file
.travis.yml 930B
file
package.json 2KB
file
tslint.json 96B
folder
.github 文件夹
file
PULL_REQUEST_TEMPLATE.md 915B
file
ISSUE_TEMPLATE.md 89B
file
CONTRIBUTING.md 859B
folder
test 文件夹
file
service.spec.ts 10KB
file
fetch.spec.ts 4KB
file
inline-funcs.spec.ts 3KB
file
fixture.ts 2KB
file
.nycrc 475B
file
LICENSE 1KB
file
package-lock.json 210KB
file
.npmignore 25B
file
tsconfig.json 377B
file
.gitignore 1KB
file
.mocharc.json 175B
folder
lib 文件夹
file
linq-service.ts 3KB
file
decorators.ts 607B
file
linq-query-provider.ts 9KB
file
linq-query.ts 2KB
file
karma.conf.js 786B
file
README.md 3KB
file
index.ts 164B
folder
.vscode 文件夹
file
settings.json 173B
zip 文件大小:73.63KB