@mountsqli/mysql 0.1.0 → 0.1.1
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.
- package/README.md +50 -0
- package/package.json +9 -3
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @mountsqli/mysql
|
|
2
|
+
|
|
3
|
+
MySQL dialect for MountSQLi with mysql2 driver support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Type-safe MySQL queries
|
|
8
|
+
- Auto-increment support
|
|
9
|
+
- VARCHAR with length
|
|
10
|
+
- MySQL ENUMs
|
|
11
|
+
- JSON columns
|
|
12
|
+
- Transaction support
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @mountsqli/mysql mysql2
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { mountsqli } from '@mountsqli/mysql/mysql2';
|
|
24
|
+
import { mysqlTable, int, varchar, boolean, timestamp } from '@mountsqli/mysql';
|
|
25
|
+
|
|
26
|
+
// Define schema
|
|
27
|
+
const users = mysqlTable('users', {
|
|
28
|
+
id: int('id').primaryKey().autoincrement(),
|
|
29
|
+
name: varchar('name', { length: 255 }).notNull(),
|
|
30
|
+
email: varchar('email', { length: 255 }).notNull().unique(),
|
|
31
|
+
active: boolean('active').default(true).notNull(),
|
|
32
|
+
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Connect
|
|
36
|
+
const db = mountsqli('mysql://user:pass@localhost:3306/mydb');
|
|
37
|
+
|
|
38
|
+
// Query with full type safety
|
|
39
|
+
const activeUsers = await db.select()
|
|
40
|
+
.from(users)
|
|
41
|
+
.where(eq(users.active, true));
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
📖 [Documentation](https://mountsqli.dev/docs/mysql/setup)
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountsqli/mysql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"main": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
-
"files": [
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
18
22
|
"scripts": {
|
|
19
23
|
"build": "tsup src/index.ts src/drivers/mysql2/index.ts --format esm --dts --clean",
|
|
20
24
|
"dev": "tsup --watch",
|
|
@@ -28,7 +32,9 @@
|
|
|
28
32
|
"mysql2": "^3.0.0"
|
|
29
33
|
},
|
|
30
34
|
"peerDependenciesMeta": {
|
|
31
|
-
"mysql2": {
|
|
35
|
+
"mysql2": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
"devDependencies": {
|
|
34
40
|
"@types/node": "^22.0.0",
|