{"id":20896241,"url":"https://github.com/waitingsong/egg-kmore","last_synced_at":"2026-04-11T13:34:02.027Z","repository":{"id":70044836,"uuid":"202861934","full_name":"waitingsong/egg-kmore","owner":"waitingsong","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-21T07:15:19.000Z","size":369,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-29T12:41:29.538Z","etag":null,"topics":["egg","egg-plugin","eggplugin","knex","midway","mssql","oracle","postgresql","sqlite3","typescript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waitingsong.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-17T09:37:05.000Z","updated_at":"2019-08-21T07:15:21.000Z","dependencies_parsed_at":"2023-06-05T01:45:42.163Z","dependency_job_id":null,"html_url":"https://github.com/waitingsong/egg-kmore","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/waitingsong/egg-kmore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fegg-kmore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fegg-kmore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fegg-kmore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fegg-kmore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waitingsong","download_url":"https://codeload.github.com/waitingsong/egg-kmore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fegg-kmore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31682953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["egg","egg-plugin","eggplugin","knex","midway","mssql","oracle","postgresql","sqlite3","typescript"],"created_at":"2024-11-18T10:34:26.926Z","updated_at":"2026-04-11T13:34:02.004Z","avatar_url":"https://github.com/waitingsong.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [egg-kmore](https://waitingsong.github.io/egg-kmore/)\n\n[kmore](https://www.npmjs.com/package/kmore) for midway framework.\n\n\n[![Version](https://img.shields.io/npm/v/egg-kmore.svg)](https://www.npmjs.com/package/egg-kmore)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n![](https://img.shields.io/badge/lang-TypeScript-blue.svg)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\n\n## Installation\n```sh\nnpm install egg-kmore knex\n\n# Then add one of the following:\nnpm install pg\nnpm install mssql\nnpm install oracle\nnpm install sqlite3\n```\n\n\n## Configuration\n\n### Enable Plugin\n\nEdit `${app_root}/src/config/plugin.ts`:\n\n```ts\nimport { EggPlugin } from 'midway'\n\nexport default {\n  kmore: {\n    enable: true,\n    package: 'egg-kmore',\n  },\n} as EggPlugin\n```\n\n### Add Configurations\n\n```ts\n/* location: ${app_root}/src/config/config.${env}.ts */\n\nimport { EggKmoreConfig, genTbListFromType, ClientOpts } from 'egg-kmore'\nimport { TbListModel } from '../app/user/user.model'\n\nconst master: ClientOpts = {\n  knexConfig: {\n    client: 'pg',\n    connection: {\n      host: 'localhost',\n      user: 'postgres',\n      password: '',\n      database: 'db_ci_test',\n    },\n    acquireConnectionTimeout: 10000,\n  },\n  tables: genTbListFromType\u003cTbListModel\u003e(),\n}\n\n// app: default true\nexport const kmore: EggKmoreConfig = {\n  client: master,\n}\n\n\n/* location: ../app/user/user.model.ts */\nexport interface TbListModel {\n  tb_user: User\n  tb_user_detail: UserDetail\n}\n\n/**\n * user info\n */\nexport interface UserInfo extends User, UserDetail {\n}\n\nexport interface User {\n  uid: number\n  user_name: string\n}\nexport interface UserDetail {\n  uid: number\n  phone: string\n  email: string\n}\n\nexport interface GetUserOpts {\n  uid: number\n}\n```\n\n\n## Usage\n\n```ts\n/* location: ../app/user/user.service.ts */\n\nimport { provide, plugin } from 'midway'\nimport { DbModel } from 'egg-kmore'\nimport { GetUserOpts, UserInfo, User, TbListModel } from './user.model'\n\n@provide()\nexport class UserService {\n\n  constructor(\n    @plugin('kmore') private readonly db: DbModel\u003cTbListModel\u003e,\n  ) { }\n\n  /**\n   * Read user info\n   */\n  public async getUser(options: GetUserOpts): Promise\u003cUserInfo\u003e {\n    const { rb, tables: t } = this.db\n\n    const row: UserInfo = await rb.tb_user()\n      .innerJoin(\n        t.tb_user_detail,\n        `${t.tb_user}.uid`,\n        `${t.tb_user_detail}.uid`,\n      )\n      .select('*')\n      .where(`${t.tb_user}.uid`, options.uid)\n      .then(rows =\u003e rows[0])\n\n    return row\n  }\n\n  /**\n   * Read user_name\n   */\n  public async getUserName(options: GetUserOpts): Promise\u003cUser['user_name']\u003e {\n    const { rb } = this.db\n\n    const name = await rb.tb_user()\n      .select('user_name')\n      .where('uid', options.uid)\n      .then(rows =\u003e rows[0] ? rows[0].user_name : '')\n\n    return name\n  }\n\n}\n```\n\n## Generating source files pre build\n\nThe files generated automatically under typescript environment for debug or test \n\n```sh\ncd ${app_root}\nkmore gen --path ./src\n\n// then you could build the project\nnpm run build\n```\n\n\n## License\n[MIT](LICENSE)\n\n\n### Languages\n- [English](README.md)\n- [中文](README.zh-CN.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaitingsong%2Fegg-kmore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaitingsong%2Fegg-kmore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaitingsong%2Fegg-kmore/lists"}