Skip to content

Commit bf506e7

Browse files
committed
readme
1 parent b446eb2 commit bf506e7

File tree

5 files changed

+68
-158
lines changed

5 files changed

+68
-158
lines changed

enums/13/README.md

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dt/@pgsql/enums"></a>
1212
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dw/@pgsql/enums"/></a>
1313
<a href="https://github.com/launchql/libpg-query-node/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
14-
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F17%2Fpackage.json"/></a>
14+
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F13%2Fpackage.json"/></a>
1515
</p>
1616

1717
`@pgsql/enums` is a TypeScript library providing enum definitions for PostgreSQL AST nodes, primarily used in conjunction with [`pgsql-parser`](https://github.com/launchql/pgsql-parser). It offers a comprehensive and type-safe way to work with PostgreSQL enum values in query parsing and AST manipulation.
@@ -27,41 +27,23 @@ npm install @pgsql/enums
2727

2828
## Usage
2929

30-
`@pgsql/enums` provides TypeScript enum definitions for PostgreSQL Abstract Syntax Tree (AST) nodes. These enums are useful for constructing, analyzing, or manipulating ASTs in a type-safe manner with exact enum values.
31-
32-
Here are a few examples of how you can use these enums in your TypeScript projects:
33-
34-
### Using Enum Values
35-
36-
You can use the enums to work with specific PostgreSQL AST enum values:
30+
Here's a simple example showing how to work with enums, converting between enum names and their numeric values:
3731

3832
```ts
39-
import { ConstrType, ObjectType } from '@pgsql/enums';
40-
41-
function createConstraint() {
42-
return {
43-
contype: ConstrType.CONSTR_PRIMARY
44-
};
45-
}
46-
47-
function getObjectType() {
48-
return ObjectType.OBJECT_TABLE;
49-
}
50-
```
51-
52-
### Type-Safe Enum Operations
33+
import { ObjectType } from '@pgsql/enums';
5334

54-
Enums help ensure that you use correct PostgreSQL enum values:
35+
// Get the numeric value of an enum
36+
const tableValue = ObjectType.OBJECT_TABLE;
37+
console.log(tableValue); // 41
5538

56-
```ts
57-
import { CmdType, JoinType } from '@pgsql/enums';
58-
59-
const command = {
60-
cmdType: CmdType.CMD_SELECT,
61-
joinType: JoinType.JOIN_INNER
62-
};
39+
// Convert from value back to enum name
40+
const enumName = ObjectType[41];
41+
console.log(enumName); // "OBJECT_TABLE"
6342

64-
console.log(command);
43+
// Use in comparisons
44+
if (someNode.objectType === ObjectType.OBJECT_TABLE) {
45+
console.log("This is a table object");
46+
}
6547
```
6648

6749
## Versions
@@ -89,4 +71,4 @@ Our latest is built with PostgreSQL 17 enum definitions.
8971

9072
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
9173

92-
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.
74+
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.

enums/14/README.md

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dt/@pgsql/enums"></a>
1212
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dw/@pgsql/enums"/></a>
1313
<a href="https://github.com/launchql/libpg-query-node/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
14-
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F17%2Fpackage.json"/></a>
14+
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F14%2Fpackage.json"/></a>
1515
</p>
1616

1717
`@pgsql/enums` is a TypeScript library providing enum definitions for PostgreSQL AST nodes, primarily used in conjunction with [`pgsql-parser`](https://github.com/launchql/pgsql-parser). It offers a comprehensive and type-safe way to work with PostgreSQL enum values in query parsing and AST manipulation.
@@ -27,41 +27,23 @@ npm install @pgsql/enums
2727

2828
## Usage
2929

30-
`@pgsql/enums` provides TypeScript enum definitions for PostgreSQL Abstract Syntax Tree (AST) nodes. These enums are useful for constructing, analyzing, or manipulating ASTs in a type-safe manner with exact enum values.
31-
32-
Here are a few examples of how you can use these enums in your TypeScript projects:
33-
34-
### Using Enum Values
35-
36-
You can use the enums to work with specific PostgreSQL AST enum values:
30+
Here's a simple example showing how to work with enums, converting between enum names and their numeric values:
3731

3832
```ts
39-
import { ConstrType, ObjectType } from '@pgsql/enums';
40-
41-
function createConstraint() {
42-
return {
43-
contype: ConstrType.CONSTR_PRIMARY
44-
};
45-
}
46-
47-
function getObjectType() {
48-
return ObjectType.OBJECT_TABLE;
49-
}
50-
```
51-
52-
### Type-Safe Enum Operations
33+
import { ObjectType } from '@pgsql/enums';
5334

54-
Enums help ensure that you use correct PostgreSQL enum values:
35+
// Get the numeric value of an enum
36+
const tableValue = ObjectType.OBJECT_TABLE;
37+
console.log(tableValue); // 41
5538

56-
```ts
57-
import { CmdType, JoinType } from '@pgsql/enums';
58-
59-
const command = {
60-
cmdType: CmdType.CMD_SELECT,
61-
joinType: JoinType.JOIN_INNER
62-
};
39+
// Convert from value back to enum name
40+
const enumName = ObjectType[41];
41+
console.log(enumName); // "OBJECT_TABLE"
6342

64-
console.log(command);
43+
// Use in comparisons
44+
if (someNode.objectType === ObjectType.OBJECT_TABLE) {
45+
console.log("This is a table object");
46+
}
6547
```
6648

6749
## Versions
@@ -89,4 +71,4 @@ Our latest is built with PostgreSQL 17 enum definitions.
8971

9072
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
9173

92-
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.
74+
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.

enums/15/README.md

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dt/@pgsql/enums"></a>
1212
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dw/@pgsql/enums"/></a>
1313
<a href="https://github.com/launchql/libpg-query-node/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
14-
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F17%2Fpackage.json"/></a>
14+
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F15%2Fpackage.json"/></a>
1515
</p>
1616

1717
`@pgsql/enums` is a TypeScript library providing enum definitions for PostgreSQL AST nodes, primarily used in conjunction with [`pgsql-parser`](https://github.com/launchql/pgsql-parser). It offers a comprehensive and type-safe way to work with PostgreSQL enum values in query parsing and AST manipulation.
@@ -27,41 +27,23 @@ npm install @pgsql/enums
2727

2828
## Usage
2929

30-
`@pgsql/enums` provides TypeScript enum definitions for PostgreSQL Abstract Syntax Tree (AST) nodes. These enums are useful for constructing, analyzing, or manipulating ASTs in a type-safe manner with exact enum values.
31-
32-
Here are a few examples of how you can use these enums in your TypeScript projects:
33-
34-
### Using Enum Values
35-
36-
You can use the enums to work with specific PostgreSQL AST enum values:
30+
Here's a simple example showing how to work with enums, converting between enum names and their numeric values:
3731

3832
```ts
39-
import { ConstrType, ObjectType } from '@pgsql/enums';
40-
41-
function createConstraint() {
42-
return {
43-
contype: ConstrType.CONSTR_PRIMARY
44-
};
45-
}
46-
47-
function getObjectType() {
48-
return ObjectType.OBJECT_TABLE;
49-
}
50-
```
51-
52-
### Type-Safe Enum Operations
33+
import { ObjectType } from '@pgsql/enums';
5334

54-
Enums help ensure that you use correct PostgreSQL enum values:
35+
// Get the numeric value of an enum
36+
const tableValue = ObjectType.OBJECT_TABLE;
37+
console.log(tableValue); // 41
5538

56-
```ts
57-
import { CmdType, JoinType } from '@pgsql/enums';
58-
59-
const command = {
60-
cmdType: CmdType.CMD_SELECT,
61-
joinType: JoinType.JOIN_INNER
62-
};
39+
// Convert from value back to enum name
40+
const enumName = ObjectType[41];
41+
console.log(enumName); // "OBJECT_TABLE"
6342

64-
console.log(command);
43+
// Use in comparisons
44+
if (someNode.objectType === ObjectType.OBJECT_TABLE) {
45+
console.log("This is a table object");
46+
}
6547
```
6648

6749
## Versions
@@ -89,4 +71,4 @@ Our latest is built with PostgreSQL 17 enum definitions.
8971

9072
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
9173

92-
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.
74+
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.

enums/16/README.md

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dt/@pgsql/enums"></a>
1212
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/npm/dw/@pgsql/enums"/></a>
1313
<a href="https://github.com/launchql/libpg-query-node/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
14-
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F17%2Fpackage.json"/></a>
14+
<a href="https://www.npmjs.com/package/@pgsql/enums"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/libpg-query-node?filename=packages%2F16%2Fpackage.json"/></a>
1515
</p>
1616

1717
`@pgsql/enums` is a TypeScript library providing enum definitions for PostgreSQL AST nodes, primarily used in conjunction with [`pgsql-parser`](https://github.com/launchql/pgsql-parser). It offers a comprehensive and type-safe way to work with PostgreSQL enum values in query parsing and AST manipulation.
@@ -27,41 +27,23 @@ npm install @pgsql/enums
2727

2828
## Usage
2929

30-
`@pgsql/enums` provides TypeScript enum definitions for PostgreSQL Abstract Syntax Tree (AST) nodes. These enums are useful for constructing, analyzing, or manipulating ASTs in a type-safe manner with exact enum values.
31-
32-
Here are a few examples of how you can use these enums in your TypeScript projects:
33-
34-
### Using Enum Values
35-
36-
You can use the enums to work with specific PostgreSQL AST enum values:
30+
Here's a simple example showing how to work with enums, converting between enum names and their numeric values:
3731

3832
```ts
39-
import { ConstrType, ObjectType } from '@pgsql/enums';
40-
41-
function createConstraint() {
42-
return {
43-
contype: ConstrType.CONSTR_PRIMARY
44-
};
45-
}
46-
47-
function getObjectType() {
48-
return ObjectType.OBJECT_TABLE;
49-
}
50-
```
51-
52-
### Type-Safe Enum Operations
33+
import { ObjectType } from '@pgsql/enums';
5334

54-
Enums help ensure that you use correct PostgreSQL enum values:
35+
// Get the numeric value of an enum
36+
const tableValue = ObjectType.OBJECT_TABLE;
37+
console.log(tableValue); // 41
5538

56-
```ts
57-
import { CmdType, JoinType } from '@pgsql/enums';
58-
59-
const command = {
60-
cmdType: CmdType.CMD_SELECT,
61-
joinType: JoinType.JOIN_INNER
62-
};
39+
// Convert from value back to enum name
40+
const enumName = ObjectType[41];
41+
console.log(enumName); // "OBJECT_TABLE"
6342

64-
console.log(command);
43+
// Use in comparisons
44+
if (someNode.objectType === ObjectType.OBJECT_TABLE) {
45+
console.log("This is a table object");
46+
}
6547
```
6648

6749
## Versions
@@ -89,4 +71,4 @@ Our latest is built with PostgreSQL 17 enum definitions.
8971

9072
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
9173

92-
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.
74+
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.

enums/17/README.md

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,23 @@ npm install @pgsql/enums
2727

2828
## Usage
2929

30-
`@pgsql/enums` provides TypeScript enum definitions for PostgreSQL Abstract Syntax Tree (AST) nodes. These enums are useful for constructing, analyzing, or manipulating ASTs in a type-safe manner with exact enum values.
31-
32-
Here are a few examples of how you can use these enums in your TypeScript projects:
33-
34-
### Using Enum Values
35-
36-
You can use the enums to work with specific PostgreSQL AST enum values:
30+
Here's a simple example showing how to work with enums, converting between enum names and their numeric values:
3731

3832
```ts
39-
import { ConstrType, ObjectType } from '@pgsql/enums';
40-
41-
function createConstraint() {
42-
return {
43-
contype: ConstrType.CONSTR_PRIMARY
44-
};
45-
}
46-
47-
function getObjectType() {
48-
return ObjectType.OBJECT_TABLE;
49-
}
50-
```
51-
52-
### Type-Safe Enum Operations
33+
import { ObjectType } from '@pgsql/enums';
5334

54-
Enums help ensure that you use correct PostgreSQL enum values:
35+
// Get the numeric value of an enum
36+
const tableValue = ObjectType.OBJECT_TABLE;
37+
console.log(tableValue); // 41
5538

56-
```ts
57-
import { CmdType, JoinType } from '@pgsql/enums';
58-
59-
const command = {
60-
cmdType: CmdType.CMD_SELECT,
61-
joinType: JoinType.JOIN_INNER
62-
};
39+
// Convert from value back to enum name
40+
const enumName = ObjectType[41];
41+
console.log(enumName); // "OBJECT_TABLE"
6342

64-
console.log(command);
43+
// Use in comparisons
44+
if (someNode.objectType === ObjectType.OBJECT_TABLE) {
45+
console.log("This is a table object");
46+
}
6547
```
6648

6749
## Versions

0 commit comments

Comments
 (0)