mdbxmou 0.3.5 → 0.3.6

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 CHANGED
@@ -185,8 +185,9 @@ const result = await env.query([
185
185
  #### Methods
186
186
 
187
187
  **createMap([db_name | keyMode], [keyMode | valueMode], [valueMode]) → DBI**
188
+ **createMap({ name, keyFlag, valueFlag, keyMode, valueMode }) → DBI**
188
189
  ```javascript
189
- // No arguments - default DB with string keys
190
+ // No arguments - default DB with env key/value flags (buffer if not set)
190
191
  const dbi = txn.createMap();
191
192
 
192
193
  // One argument - keyMode only
@@ -203,13 +204,23 @@ const namedDbi = txn.createMap("my-table", MDBX_Param.keyMode.ordinal);
203
204
 
204
205
  // Three arguments - db_name + keyMode + valueMode
205
206
  const namedDbi = txn.createMap("my-table", MDBX_Param.keyMode.ordinal, MDBX_Param.valueMode.multi);
207
+
208
+ // Object form - explicit flags/modes
209
+ const dbi = txn.createMap({
210
+ name: "my-table",
211
+ keyFlag: MDBX_Param.keyFlag.string,
212
+ valueFlag: MDBX_Param.valueFlag.string,
213
+ keyMode: MDBX_Param.keyMode.reverse,
214
+ valueMode: MDBX_Param.valueMode.multi
215
+ });
206
216
  ```
207
217
 
208
218
  > **Note**: Use `createMap` in write transactions - it will create the database if it doesn't exist, or open it if it does. This is safer for new environments.
209
219
 
210
220
  **openMap([db_name | keyMode], [keyMode]) → DBI**
221
+ **openMap({ name, keyFlag, valueFlag, keyMode, valueMode }) → DBI**
211
222
  ```javascript
212
- // No arguments - default DB with string keys
223
+ // No arguments - default DB with env key/value flags (buffer if not set)
213
224
  const dbi = txn.openMap();
214
225
 
215
226
  // One argument - keyMode only
@@ -224,6 +235,15 @@ const namedDbi = txn.openMap("my-table");
224
235
  // Two arguments - db_name + keyMode
225
236
  const namedDbi = txn.openMap("my-table", MDBX_Param.keyMode.ordinal);
226
237
  const namedDbiBigInt = txn.openMap("my-table", BigInt(MDBX_Param.keyMode.ordinal));
238
+
239
+ // Object form - explicit flags/modes
240
+ const dbi = txn.openMap({
241
+ name: "my-table",
242
+ keyFlag: MDBX_Param.keyFlag.string,
243
+ valueFlag: MDBX_Param.valueFlag.string,
244
+ keyMode: MDBX_Param.keyMode.reverse,
245
+ valueMode: MDBX_Param.valueMode.multi
246
+ });
227
247
  ```
228
248
 
229
249
  > **Note**: Use `openMap` in read transactions or when you're sure the database already exists. For write transactions on new environments, prefer `createMap`.
@@ -231,6 +251,7 @@ const namedDbiBigInt = txn.openMap("my-table", BigInt(MDBX_Param.keyMode.ordinal
231
251
  > **Note**: When using ordinal keyMode, the key type in results depends on how you specify keyMode:
232
252
  > - `keyMode: number` → keys returned as `number`
233
253
  > - `keyMode: BigInt(number)` → keys returned as `BigInt`
254
+ > - When you pass `keyMode.ordinal` as a positional argument (Number/BigInt), it also updates `keyFlag` to number/bigint unless a numeric keyFlag was already set in env or explicitly provided.
234
255
 
235
256
  **commit()**
236
257
  ```javascript
package/package.json CHANGED
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "gypfile": true,
67
67
  "name": "mdbxmou",
68
- "version": "0.3.5",
68
+ "version": "0.3.6",
69
69
  "description": "Node bindings for mdbx",
70
70
  "repository": {
71
71
  "type": "git",
package/src/txnmou.cpp CHANGED
@@ -102,6 +102,7 @@ Napi::Value txnmou::get_dbi(const Napi::Object& arg0, db_mode db_mode)
102
102
  {
103
103
  auto env = arg0.Env();
104
104
  auto conf = get_env_userctx(*env_);
105
+ // параметры по умолчанию из окружения
105
106
  auto key_flag = conf->key_flag;
106
107
  auto value_flag = conf->value_flag;
107
108
  key_mode key_mode{};