Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zamarawka/typeorm-explain

Tiny helper to wrap TypeORM's query builder queries to EXPLAIN
https://github.com/zamarawka/typeorm-explain

orm typeorm typescript

Last synced: about 10 hours ago
JSON representation

Tiny helper to wrap TypeORM's query builder queries to EXPLAIN

Awesome Lists containing this project

README

        

[![Ci Status](https://github.com/zamarawka/typeorm-explain/workflows/CI/badge.svg)](https://github.com/zamarawka/typeorm-explain/actions)
[![Npm version](https://img.shields.io/npm/v/typeorm-explain.svg?style=flat&logo=npm)](https://www.npmjs.com/package/typeorm-explain)

# typeorm-explain

Tiny helper to wrap TypeORM's query builder queries into `EXPLAIN`.

# Install

```sh
npm install typeorm-explain
```

# Usage

> Currently supports only Postgres driver. Feel free to open PR and add more drivers.

```ts
import explain from 'typeorm-explain';

import { getConnection } from 'typeorm';

const userQuery = getConnection()
.createQueryBuilder()
.select('user')
.from(User, 'user')
.where('user.id = :id', { id: 1 });

console.log(await explain(userQuery)); // Print explain in console

const user = await userQuery.getOne();
```

# Development

```sh
npm run format # code fomatting
npm run lint # linting
npm run build # build
```

Active maintenance with care and ❤️.

Feel free to send a PR.