@areumtecnologia/mysql-db-handler 1.0.3 → 1.0.4
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 +21 -0
- package/desktop.ini +0 -0
- package/lib/desktop.ini +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,27 @@ const activeCustomers = await customers.selectBy({ status: 1 });
|
|
|
66
66
|
|
|
67
67
|
## Advanced Usage & Examples
|
|
68
68
|
|
|
69
|
+
### Inserting Records (`insert`)
|
|
70
|
+
|
|
71
|
+
The `insert` method adds a new row to the table.
|
|
72
|
+
|
|
73
|
+
**Parameters:**
|
|
74
|
+
* `params` (Object): An object where keys match the column names and values are the data to insert.
|
|
75
|
+
|
|
76
|
+
**Example:**
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
const logs = new DataBaseHandler(db, 'app_logs');
|
|
80
|
+
|
|
81
|
+
const result = await logs.insert({
|
|
82
|
+
level: 'info',
|
|
83
|
+
message: 'User logged in',
|
|
84
|
+
timestamp: new Date()
|
|
85
|
+
});
|
|
86
|
+
// Executes: INSERT INTO app_logs SET `level` = ?, `message` = ?, `timestamp` = ?
|
|
87
|
+
console.log(`Inserted Row ID: ${result.insertId}`);
|
|
88
|
+
```
|
|
89
|
+
|
|
69
90
|
### Flexible Selection (`select`)
|
|
70
91
|
|
|
71
92
|
The `select` method allows you to build complex queries using an array of parameters and a clauses object.
|
package/desktop.ini
ADDED
|
Binary file
|
package/lib/desktop.ini
ADDED
|
Binary file
|
package/package.json
CHANGED