Comparing version 48.0.0 to 48.0.1
@@ -27,7 +27,2 @@ import assert from 'node:assert'; | ||
}); | ||
// const queryCtxOpts: QueryContext = { | ||
// wrapIdentifierCaseConvert: kmore.wrapIdentifierCaseConvert, | ||
// postProcessResponseCaseConvert: caseConvert, | ||
// kmoreQueryId, | ||
// } | ||
// const builderPagerSql = builderPagerPatched.toQuery() | ||
@@ -34,0 +29,0 @@ // console.info({ builderPageSql: builderPagerSql }) |
{ | ||
"name": "kmore", | ||
"author": "waiting", | ||
"version": "48.0.0", | ||
"version": "48.0.1", | ||
"description": "A SQL query builder based on knex with powerful TypeScript type support", | ||
@@ -81,3 +81,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "f6637fe98599bab61b6fa226d9196fb32f9967f9" | ||
"gitHead": "88acf7910e64b1471219894a0a6aabbd5fdab703" | ||
} |
@@ -8,3 +8,3 @@ # [kmore](https://waitingsong.github.io/kmore/) | ||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
![](https://img.shields.io/badge/lang-TypeScript-blue.svg) | ||
[![](https://img.shields.io/badge/lang-TypeScript-blue.svg)]() | ||
[![ci](https://github.com/waitingsong/kmore/workflows/ci/badge.svg)](https://github.com/waitingsong/kmore/actions) | ||
@@ -20,2 +20,3 @@ [![codecov](https://codecov.io/gh/waitingsong/kmore/branch/main/graph/badge.svg?token=wNYqpmseCn)](https://codecov.io/gh/waitingsong/kmore) | ||
- Type-safe auto-completion in IDE | ||
- Auto Paging with one query | ||
@@ -183,2 +184,20 @@ | ||
### Auto Paging | ||
``` | ||
const options: Partial<PagingOptions> = { | ||
page: 2, // default 1 | ||
pageSize: 20, // default 10 | ||
} | ||
const users = await tables.ref_tb_user().autoPaging(options) | ||
assert(Array.isArray(users)) | ||
assert(users.length) | ||
// not enumerable properties of pager | ||
const { pageCountAll, pageCurrent, pageSize } = users | ||
``` | ||
More examples of auto paging see [auto-paing](https://github.com/waitingsong/kmore/blob/main/packages/kmore/test/auto-paging/) | ||
### Use instance of knex | ||
@@ -200,3 +219,3 @@ ```ts | ||
import { genDbDict } from 'kmore-types' | ||
import { KmoreSourceConfig } from '@mw-components/kmore' | ||
import { KmoreSourceConfig } from '@mwcp/kmore' | ||
import { TbAppDO, TbMemberDO } from '../do/database.do.js' | ||
@@ -275,3 +294,3 @@ | ||
| [`kmore-cli`] | [![cli-svg]][cli-ch] | | ||
| [`midway-component-kmore`] | [![mw-svg]][mw-ch] | | ||
| [`@mwcp/kmore`] | [![mw-svg]][mw-ch] | | ||
@@ -292,32 +311,16 @@ | ||
[`kmore-cli`]: https://github.com/waitingsong/kmore/tree/main/packages/kmore-cli | ||
[`midway-component-kmore`]: https://github.com/waitingsong/kmore/tree/main/packages/midway-component-kmore | ||
[`@mwcp/kmore`]: https://github.com/waitingsong/kmore/tree/main/packages/midway-component-kmore | ||
[kmore-svg]: https://img.shields.io/npm/v/kmore.svg?maxAge=7200 | ||
[kmore-ch]: https://github.com/waitingsong/kmore/tree/main/packages/kmore/CHANGELOG.md | ||
[kmore-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore | ||
[kmore-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore | ||
[kmore-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/kmore | ||
[kmore-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/kmore#info=devDependencies | ||
[types-svg]: https://img.shields.io/npm/v/kmore-types.svg?maxAge=7200 | ||
[types-ch]: https://github.com/waitingsong/kmore/tree/main/packages/kmore-types/CHANGELOG.md | ||
[types-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-types | ||
[types-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-types | ||
[types-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/kmore-types | ||
[types-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/kmore-types#info=devDependencies | ||
[cli-svg]: https://img.shields.io/npm/v/kmore-cli.svg?maxAge=7200 | ||
[cli-ch]: https://github.com/waitingsong/kmore/tree/main/packages/kmore-clie/CHANGELOG.md | ||
[cli-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-cli | ||
[cli-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-cli | ||
[cli-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/kmore-cli | ||
[cli-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/kmore-cli#info=devDependencies | ||
[mw-svg]: https://img.shields.io/npm/v/@mw-components/kmore.svg?maxAge=7200 | ||
[mw-svg]: https://img.shields.io/npm/v/@mwcp/kmore.svg?maxAge=7200 | ||
[mw-ch]: https://github.com/waitingsong/kmore/tree/main/packages/midway-component-kmore/CHANGELOG.md | ||
[mw-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/midway-component-kmore | ||
[mw-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/midway-component-kmore | ||
[mw-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/midway-component-kmore | ||
[mw-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/egg-kmore#info=midway-component-kmore | ||
@@ -328,1 +331,3 @@ | ||
[pg-native]: https://github.com/brianc/node-pg-native | ||
[OpenTelemetry]: https://github.com/open-telemetry/opentelemetry-js-api | ||
@@ -9,3 +9,3 @@ # [kmore](https://waitingsong.github.io/kmore/) | ||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
![](https://img.shields.io/badge/lang-TypeScript-blue.svg) | ||
[![](https://img.shields.io/badge/lang-TypeScript-blue.svg)]() | ||
[![ci](https://github.com/waitingsong/kmore/workflows/ci/badge.svg)](https://github.com/waitingsong/kmore/actions) | ||
@@ -21,2 +21,3 @@ [![codecov](https://codecov.io/gh/waitingsong/kmore/branch/main/graph/badge.svg?token=wNYqpmseCn)](https://codecov.io/gh/waitingsong/kmore) | ||
- 类型安全的 IDE 编辑器自动完成 | ||
- 一条查询链实现自动分页 | ||
@@ -27,3 +28,3 @@ ## 安装 | ||
// for Midway.js | ||
npm i @mw-components/kmore && npm i -D kmore-cli | ||
npm i @mwcp/kmore && npm i -D kmore-cli | ||
@@ -180,5 +181,23 @@ # Then add one of the following: | ||
More examples of join see [joint-table](https://github.com/waitingsong/kmore/blob/main/packages/kmore/test/join-table/71.advanced.test.ts) | ||
More examples of join see [joint-table](https://github.com/waitingsong/kmore/blob/main/packages/kmore/test/join-table/) | ||
### 自动分页 | ||
``` | ||
const options: Partial<PagingOptions> = { | ||
page: 2, // default 1 | ||
pageSize: 20, // default 10 | ||
} | ||
const users = await tables.ref_tb_user().autoPaging(options) | ||
assert(Array.isArray(users)) | ||
assert(users.length) | ||
// 不可枚举分页属性 | ||
const { pageCountAll, pageCurrent, pageSize } = users | ||
``` | ||
More examples of auto paging see [auto-paing](https://github.com/waitingsong/kmore/blob/main/packages/kmore/test/auto-paging/) | ||
### 使用 knex | ||
@@ -200,3 +219,3 @@ ```ts | ||
import { genDbDict } from 'kmore-types' | ||
import { KmoreSourceConfig } from '@mw-components/kmore' | ||
import { KmoreSourceConfig } from '@mwcp/kmore' | ||
import { TbAppDO, TbMemberDO } from '../do/database.do.js' | ||
@@ -275,3 +294,3 @@ | ||
| [`kmore-cli`] | [![cli-svg]][cli-ch] | | ||
| [`midway-component-kmore`] | [![mw-svg]][mw-ch] | | ||
| [`@mwcp/kmore`] | [![mw-svg]][mw-ch] | | ||
@@ -292,32 +311,16 @@ | ||
[`kmore-cli`]: https://github.com/waitingsong/kmore/tree/main/packages/kmore-cli | ||
[`midway-component-kmore`]: https://github.com/waitingsong/kmore/tree/main/packages/midway-component-kmore | ||
[`@mwcp/kmore`]: https://github.com/waitingsong/kmore/tree/main/packages/midway-component-kmore | ||
[kmore-svg]: https://img.shields.io/npm/v/kmore.svg?maxAge=7200 | ||
[kmore-ch]: https://github.com/waitingsong/kmore/tree/main/packages/kmore/CHANGELOG.md | ||
[kmore-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore | ||
[kmore-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore | ||
[kmore-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/kmore | ||
[kmore-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/kmore#info=devDependencies | ||
[types-svg]: https://img.shields.io/npm/v/kmore-types.svg?maxAge=7200 | ||
[types-ch]: https://github.com/waitingsong/kmore/tree/main/packages/kmore-types/CHANGELOG.md | ||
[types-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-types | ||
[types-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-types | ||
[types-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/kmore-types | ||
[types-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/kmore-types#info=devDependencies | ||
[cli-svg]: https://img.shields.io/npm/v/kmore-cli.svg?maxAge=7200 | ||
[cli-ch]: https://github.com/waitingsong/kmore/tree/main/packages/kmore-clie/CHANGELOG.md | ||
[cli-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-cli | ||
[cli-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/kmore-cli | ||
[cli-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/kmore-cli | ||
[cli-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/kmore-cli#info=devDependencies | ||
[mw-svg]: https://img.shields.io/npm/v/@mw-components/kmore.svg?maxAge=7200 | ||
[mw-svg]: https://img.shields.io/npm/v/@mwcp/kmore.svg?maxAge=7200 | ||
[mw-ch]: https://github.com/waitingsong/kmore/tree/main/packages/midway-component-kmore/CHANGELOG.md | ||
[mw-d-svg]: https://david-dm.org/waitingsong/kmore.svg?path=packages/midway-component-kmore | ||
[mw-d-link]: https://david-dm.org/waitingsong/kmore.svg?path=packages/midway-component-kmore | ||
[mw-dd-svg]: https://david-dm.org/waitingsong/kmore/dev-status.svg?path=packages/midway-component-kmore | ||
[mw-dd-link]: https://david-dm.org/waitingsong/kmore?path=packages/egg-kmore#info=midway-component-kmore | ||
@@ -328,2 +331,3 @@ | ||
[pg-native]: https://github.com/brianc/node-pg-native | ||
[OpenTelemetry]: https://github.com/open-telemetry/opentelemetry-js-api | ||
@@ -46,8 +46,2 @@ import assert from 'node:assert' | ||
// const queryCtxOpts: QueryContext = { | ||
// wrapIdentifierCaseConvert: kmore.wrapIdentifierCaseConvert, | ||
// postProcessResponseCaseConvert: caseConvert, | ||
// kmoreQueryId, | ||
// } | ||
// const builderPagerSql = builderPagerPatched.toQuery() | ||
@@ -54,0 +48,0 @@ // console.info({ builderPageSql: builderPagerSql }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327
353206
5826