You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -40,14 +40,14 @@ Built to power [pgsql-parser](https://github.com/constructive-io/pgsql-parser),
40
40
### 🔀 Multi-Version Support with @pgsql/parser
41
41
42
42
> **Need to support multiple PostgreSQL versions at runtime?**
43
-
> Use [`@pgsql/parser`](https://github.com/constructive-io/libpg-query-node/tree/main/parser) for dynamic version selection — parse SQL with PostgreSQL 15, 16, or 17 in a single package!
43
+
> Use [`@pgsql/parser`](https://github.com/constructive-io/libpg-query-node/tree/main/parser) for dynamic version selection — parse SQL with PostgreSQL 15, 16, 17, or 18 in a single package!
44
44
>
45
45
> ```typescript
46
46
>import { parse } from'@pgsql/parser';
47
47
>
48
48
>// Parse with specific PostgreSQL version
49
49
>const result15 =awaitparse('SELECT * FROM users', 15);
50
-
>constresult17=awaitparse('SELECT * FROM users', 17);
50
+
>constresult18=awaitparse('SELECT * FROM users', 18);
51
51
>```
52
52
53
53
## Installation
@@ -62,7 +62,7 @@ npm install libpg-query
62
62
import { parse } from'libpg-query';
63
63
64
64
const result =awaitparse('SELECT * FROM users WHERE active = true');
|**[@libpg-query/parser](https://github.com/constructive-io/libpg-query-node/tree/main/full)**| Full parser with all features | 17 only |[`@libpg-query/parser`](https://www.npmjs.com/package/@libpg-query/parser)|
81
81
82
82
### Version Tags
@@ -85,12 +85,13 @@ Each versioned package uses npm dist-tags for PostgreSQL version selection:
`@pgsql/enums` is a TypeScript library providing enum definitions for PostgreSQL AST nodes, primarily used in conjunction with [`pgsql-parser`](https://github.com/constructive-io/pgsql-parser). It offers a comprehensive and type-safe way to work with PostgreSQL enum values in query parsing and AST manipulation.
18
+
19
+
20
+
## Installation
21
+
22
+
Install the package via npm:
23
+
24
+
```bash
25
+
npm install @pgsql/enums
26
+
```
27
+
28
+
## Usage
29
+
30
+
Here's a simple example showing how to work with enums, converting between enum names and their numeric values:
31
+
32
+
```ts
33
+
import { ObjectType } from'@pgsql/enums';
34
+
35
+
// Get the numeric value of an enum
36
+
const tableValue =ObjectType.OBJECT_TABLE;
37
+
console.log(tableValue); // 41
38
+
39
+
// Convert from value back to enum name
40
+
const enumName =ObjectType[41];
41
+
console.log(enumName); // "OBJECT_TABLE"
42
+
43
+
// Use in comparisons
44
+
if (someNode.objectType===ObjectType.OBJECT_TABLE) {
45
+
console.log("This is a table object");
46
+
}
47
+
```
48
+
49
+
## Versions
50
+
51
+
Our latest is built with PostgreSQL 17 enum definitions.
*[pgsql-parser](https://www.npmjs.com/package/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
64
+
*[pgsql-deparser](https://www.npmjs.com/package/pgsql-deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
65
+
*[@pgsql/parser](https://www.npmjs.com/package/@pgsql/parser): Multi-version PostgreSQL parser with dynamic version selection at runtime, supporting PostgreSQL 15, 16, and 17 in a single package.
66
+
*[@pgsql/types](https://www.npmjs.com/package/@pgsql/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
67
+
*[@pgsql/enums](https://www.npmjs.com/package/@pgsql/enums): Provides TypeScript enum definitions for PostgreSQL constants, enabling type-safe usage of PostgreSQL enums and constants in your applications.
68
+
*[@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): A comprehensive utility library for PostgreSQL, offering type-safe AST node creation and enum value conversions, simplifying the construction and manipulation of PostgreSQL ASTs.
69
+
*[pg-proto-parser](https://www.npmjs.com/package/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
70
+
*[libpg-query](https://github.com/constructive-io/libpg-query-node): The real PostgreSQL parser exposed for Node.js, used primarily in `pgsql-parser` for parsing and deparsing SQL queries.
71
+
72
+
## Credits
73
+
74
+
**🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
75
+
76
+
77
+
## Disclaimer
78
+
79
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
80
+
81
+
No developer or entity involved in creating Software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Software code or Software CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
0 commit comments