Skip to content

Commit

Permalink
Replace badge and minor corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmp135 committed Mar 16, 2024
1 parent 3589702 commit 79481ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

[![npm (scoped)](https://img.shields.io/npm/v/@rmp135/sql-ts)](https://www.npmjs.com/package/@rmp135/sql-ts)
[![npm](https://img.shields.io/npm/dw/@rmp135/sql-ts)](https://www.npmjs.com/package/@rmp135/sql-ts)
[![Build Status](https://app.travis-ci.com/rmp135/sql-ts.svg?branch=master)](https://app.travis-ci.com/rmp135/sql-ts)

[![Run Tests](https://github.com/rmp135/sql-ts/actions/workflows/test.yml/badge.svg)](https://github.com/rmp135/sql-ts/actions/workflows/test.yml)

</div>

Expand Down Expand Up @@ -46,15 +45,15 @@ Install into your project using npm / yarn.

`npm install @rmp135/sql-ts`

Install your relevant SQL driver. Refer to the [knex documentation](http://knexjs.org/#Installation-node) to determine which driver you should install. For example `npm install mysql`.
Install your relevant SQL driver. Refer to the [knex documentation](http://knexjs.org/#Installation-node) to determine which driver you should install. For example `npm install mysql2`.

Create a configuration file, for example `mysql.json`. This will mirror connection details from knex. The `client` property will determine the SQL provider.

The most basic MySQL setup is below, modify as appropriate. Additional options can be applied by referring to the [Config](https://rmp135.github.io/sql-ts/#/?id=config).

```json
{
"client":"mysql2",
"client": "mysql2",
"connection": {
"host": "localhost",
"user": "user",
Expand All @@ -76,5 +75,5 @@ The file will be exported with the filename `Database.ts` (or with the name spec

### Node Module

For finer grained control of the exported types, you can use the node API. See how in the [documentation](https://rmp135.github.io/sql-ts/#/?id=usage).
For finer grained control of the exported types, you can use the node API. See how in the [documentation](https://rmp135.github.io/sql-ts/#/?id=node-module).

4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const definition = await Client
.toTypescript()
```

To output the database as an object for processing before converting to TypeScript use `toObject`.
To output the database as an object for processing before converting to TypeScript use `toObject` and continue with `fromObject`.

```js
const asObject = await Client
Expand All @@ -134,7 +134,7 @@ const asObject = await Client
// Process asObject here.

const definition = await Client
.fromObject(asObject)
.fromObject(asObject, config)
.toTypescript()
```

Expand Down

0 comments on commit 79481ce

Please sign in to comment.