open-index/open-npm huggingface dataset:
npm package: @lcsga/ng-utils
Description: Provides Angular utils
Latest version: 1.0.0

# @lcsga/ng-utils

## types

### This package provides a set utility types for angular.

<br/>

- [ExtractRouteInputs](https://github.com/LcsGa/devkit/blob/4d70cde222f09c58096a882f3f5e86abd49d816c/packages/ng-utils/types/src/lib/route-inputs.ts?plain=1#L37-L39): Extracts the route's **path parameters**, the **resolved values** and the **data values** to create an object type to implement in `@Component`s

  #### Example:

  ```ts
  // app.routes.ts

  const userRoute = {
    path: 'user/:id' as const,
    data: { someData: true },
    resolve: { user: () => of({ name: 'Lucas', age: 26 }).pipe(delay(500)) },
    loadComponent: () => import('./user.component'),
  } satisfies Route;

  export type UserRouteInputs = ExtractRouteInputs<typeof userRoute>;
  /* Output:
    {
      id: string:
      someData: boolean;
      user: {
        name: string;
        age: number;
      }
    }
  */

  export const routes: Routes = [userRoute];
  ```

  In the example above, we can see two import things to extract the route inputs:

  - the use of `{ ... } satisfies Route` instead of a basic `userRoute: Route` => this is really important to let typescript **infer** the type of `userRoute` but still **keeping autocompletion** and **type validation** during the development phase
  - the use of `as const` for the `path`: it helps typescript **infer** `'user/:id'` instead of `string` => it's necessary to extract `id` as the **path param input**

  <br/>

  This `ExtractRouteInputs` is composed of the flattened:

  - [ExtractRoutePath](https://github.com/LcsGa/devkit/blob/4d70cde222f09c58096a882f3f5e86abd49d816c/packages/ng-utils/types/src/lib/route-inputs.ts?plain=1#L5-L13)
  - [ExtractRouteData](https://github.com/LcsGa/devkit/blob/4d70cde222f09c58096a882f3f5e86abd49d816c/packages/ng-utils/types/src/lib/route-inputs.ts?plain=1#L15-L21)
  - [ExtractRouteResolve](https://github.com/LcsGa/devkit/blob/4d70cde222f09c58096a882f3f5e86abd49d816c/packages/ng-utils/types/src/lib/route-inputs.ts?plain=1#L23-L33)

  <br/>

  NB: Since query parameters are not declared in a **Route** we cannot extract them.
npm package: @lct/egg-tl5
Description: egg plugin l5
Author: fefeding
Latest version: 1.0.4


[![](http://tnpm.oa.com/badge/v/@tencent/egg-tl5.svg?style=flat-square)](http://tnpm.oa.com/package/@tencent/egg-tl5)
[![](https://img.shields.io/badge/node-%3E%3D8.0.0-brightgreen.svg?style=flat-square)](http://tnpm.oa.com/package/@tencent/egg-tl5)
# egg-tl5

egg l5插件, 依赖`@tencent/cl5`

## Install

```bash
$ npm i @tencent/egg-tl5 --save
```

## Usage

```js
// {app_root}/config/plugin.js
exports.tl5 = {
  enable: true,
  package: '@tencent/egg-tl5',
};
```

## Configuration



如果用config来配置，则可以直用名称来取值
```js
// {app_root}/config/config.default.js
exports.tl5 = {
  timeout: 0.2, // 可选，单位(s)
  test: {
    modid: 123456,
    cmd: 123456,
    timeout: 0.2  // 超时配置，可选 单位(s)
  },
  prod: {
    modid: 123,
    cmd: 123
  }
};
```

see [config/config.default.js](config/config.default.js) for more detail.

## Example
// 直接用modid  cmd 调用
```js
  //@returns {ret:0, ip:'', port: 0}
  const res = await this.ctx.helper.getL5(123456, 123456); // modid, cmd.   第三个参数timeout可选 默认=0.2
```


按配置项调用
```js
const res = await this.ctx.helper.getL5('test');// test / prod
```

#### 重置上下文缓存
当次请求会把同一个`modid:cmd` 缓存到`this.ctx.l5_cache`下。保证同一次`http`请求只获取一次l5。
这里并不会一直缓存，`context`又会继续去拉取的。
如果需要刷新它，用参数`-1`

```js
const res = await this.ctx.helper.getL5('test');
// 此处发现 res中的ip访问出错，想换个服务器重试一次
const res2 = await this.ctx.helper.getL5('test', -1);// 刷新this.ctx中的当前test l5缓存

//const res = await this.ctx.helper.getL5(123456, 123456, -1); // 刷新mod cmd 的当前this.ctx中的缓存
```

上报
```js
this.ctx.helper.reportL5('test', {
  ret: 0,
  ip: '127.0.0.1',
  port: 8010,
  delay: 100,
  pre: 0,
  flow: 0
});

this.ctx.helper.reportL5('test', {
  ret: 0,
  modid: 1234,
  cmd: 1234,
  ip: '127.0.0.1',
  port: 8010,
  delay: 100,
  pre: 0,
  flow: 0
});
```
## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues).

## License

[MIT](LICENSE)
npm package: @lct/orm
Description: ORM规范
Author: jiamao
Latest version: 1.0.37

# ORM
[![Latest NPM release](https://img.shields.io/npm/v/@lct/orm.svg)](https://www.npmjs.com/package/@lct/orm)

## 介绍
本项目为基于`typescript`的一个ORM规范。对`Model`做一个约定，提供DB访问ORM接口。
> 接口：[https://github.com/jiamao/orm/blob/master/api.md](https://github.com/jiamao/orm/blob/master/api.md)
## 快速上手
#### 安装
```javascript
npm install @lct/orm
```

#### 定义Model
Model我们认为是跟表一一对应的类。
```javascript
import { BaseModel } from "@lct/orm";

@BaseModel.Table('t_user') //关联表t_user,
//@BaseModel.Table(tablename, ['id'])//可以从这里指定多个主健，也可以在属性中去指定
class MyModel extends BaseModel {  
    @BaseModel.TableField('Fid') //映射属性跟字段, 这里可以不指定这句，默认为关联上Fid
    @BaseModel.TablePrimaryKey() //指定当前属性为唯一健
    id: number = 0;
    @BaseModel.TableField('Fname')
    name: string = "";
    nickName: string = "";
    createTime: string = "";
}
```
#### 使用ORM操作DB
```javascript
import * as mysql from "mysql";
import { BaseModel, DBHelper } from "@lct/orm";
//本地测试数据库
//先准备好测试DB
const connection = mysql.createConnection({
    host     : 'localhost',
    user     : 'jiamao',
    password : '123456',
    database : 'test',
    charset  : 'utf8'
  });

  //实例化DB操作
const db = new DBHelper(connection);
insert();

//新增一个user
async insert() {
    connection.connect();

    let m = new MyModel();
    m.name = "my name";
    m.nickName = "name";
    let ret = await db.insert(m); 
    console.log(ret);
    
    connection.end();
}
```

#### 测试用例
 测试用例是基于mocha的，依赖`mocha`和`assert`。 <br />
 表结构参见`test/t_user.sql`，更新`test/index.ts`中的数据库连接信息。  <br />
 装上依赖后直接执行以下命令即可。 <br />
```
npm run test
```