sqlx-ts 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -11
  2. package/package.json +1 -1
  3. package/sqlx-ts +0 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <h1 align="center">SQLx-ts</h1>
1
+ <h1 align="center">sqlx-ts</h1>
2
2
 
3
3
  <div align="center">
4
4
  <a href='https://coveralls.io/github/JasonShin/sqlx-ts?branch=main'><img src='https://coveralls.io/repos/github/JasonShin/sqlx-ts/badge.svg?branch=main' alt='Coverage Status' /></a>
@@ -12,18 +12,12 @@
12
12
 
13
13
  <br />
14
14
 
15
- <div align="center">
16
- Built to free Node developers from ORMs' unpredictably generated SQL queries
17
- </div>
18
-
19
- <br />
20
-
21
- SQLx-ts is a CLI application featuring compile-time checked queries without a DSL and prevents broken SQL queries being run during runtime.
15
+ SQLx-ts is a CLI application featuring compile-time checked queries without a DSL and generates types against SQLs to keep your code type-safe
22
16
 
23
- - **Compile time checked queries** - never ship a broken SQL query to production
17
+ - **Compile time checked queries** - never ship a broken SQL query to production (and [sqlx-ts is not an ORM](https://github.com/JasonShin/sqlx-ts#sqlx-ts-is-not-an-orm))
24
18
  - **TypeScript type generations** - generates type definitions based on the raw SQLs and you can use them with any MySQL or PostgreSQL driver
25
- - **Database Agnostic** - support for [PostgreSQL](http://postgresql.org/) and [MySQL](https://www.mysql.com/)
26
- - **TypeScript and JavaScript** - supports for both [TypeScript](https://www.typescriptlang.org/) and JavaScript
19
+ - **Database Agnostic** - support for [PostgreSQL](http://postgresql.org/) and [MySQL](https://www.mysql.com/) (and more DB supports to come)
20
+ - **TypeScript and JavaScript** - supports for both [TypeScript](https://jasonshin.github.io/sqlx-ts/reference-guide/4.typescript-types-generation.html) and [JavaScript](https://github.com/JasonShin/sqlx-ts#using-sqlx-ts-in-vanilla-javascript)
27
21
 
28
22
  <br>
29
23
  <div align="center">
@@ -147,6 +141,22 @@ $ curl -LSfs https://jasonshin.github.io/sqlx-ts/install.sh | \
147
141
  sh -s -- --help
148
142
  ```
149
143
 
144
+ ### sqlx-ts is not an ORM!
145
+
146
+ sqlx-ts supports **compile-time checked queries** and **generated types against SQLs**. It does not, however, do this by providing DSL (domain-specific language) for building queries. Instead, it provides macros that take regular SQL as input and ensure that it is valid against the target database. The way it works is that sqlx-ts connects to your local or development database at compile-time and have database itself to verify the queries, also generate types based on information_schema. This can have many benefits that typical ORMs cannot provide
147
+ - Since sqlx-ts simply sends the queries back to the DB, almost any SQL syntax can be used in sqlx-ts (including things added by database extensions)
148
+ - You can easily optimize the queries as the SQLs are not built using a query-builder or an ORM interface
149
+ - The generated types work well with almost any database driver or even ORMs if they have good typescript support (that allows you to override input and output types)
150
+
151
+ but it comes with some implications
152
+ - The amount of information that sqlx-ts retrieves depend on the type of the database (e.g. MySQL vs PostgreSQL)
153
+
154
+ If you are looking for an ORM, you can checkout [Sequelize](https://sequelize.org/) or [Prisma](https://www.prisma.io/).
155
+
156
+ ### Using sqlx-ts in vanilla JavaScript
157
+
158
+ If you are trying to use sqlx-ts against vanilla JS, the [TypeScript type-generation](https://jasonshin.github.io/sqlx-ts/reference-guide/4.typescript-types-generation.html) feature wouldn't be helpful. You can simply use [SQL Check](https://jasonshin.github.io/sqlx-ts/reference-guide/1.sql-check.html) feature to keep your SQLs in JS code safe and compile-time checked.
159
+
150
160
  ### Motivation
151
161
 
152
162
  I would like to bring the powerful compile-time safety ideas to Node.js. [sqlx](https://github.com/launchbadge/sqlx) is a great example of this, as it provides compile-time check of SQLs within your Rust code and Rust itself provides a great environment for tools like sqlx. sqlx-ts is greatly inspired by [sqlx](https://github.com/launchbadge/sqlx), but solves additional problems of generating TypeScript interfaces based on the SQL queries that are present in your code.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlx-ts",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "sqlx-ts ensures your raw SQLs are compile-time checked",
5
5
  "main": "dist/index.js",
6
6
  "maintainers": [
package/sqlx-ts CHANGED
Binary file