dragonfly/docs/hash/hashSetIdBulk.md
Jacob Schmidt c8d81ba3bb
All checks were successful
Build / Build (push) Successful in 39s
docs: Update README.md with detailed documentation
This commit significantly enhances the `README.md` file, providing comprehensive documentation for the ArmaDragonflyClient.

Key changes:

*   **Detailed Function Categories:** Categorized functions for better organization (Core, Basic Data Operations, Hash Operations, List Operations).
*   **Usage Examples:** Added clear and concise usage examples for basic operations, hash operations (context and ID-specific), and list operations.
*   **Function Documentation Structure:** Outlined the structure for individual function documentation.
*   **License Information:** Updated the license information.
2025-03-30 17:15:35 -05:00

69 lines
3.0 KiB
Markdown

---
title: ArmaDragonflyClient - Hash Set ID Bulk
icon: mdi:file-text-outline
excerpt: Set the specified fields to their respective values in the hash stored at key from DragonflyClient.
---
# dragonfly_db_fnc_hashSetIdBulk
## Description
Sets multiple field-value pairs in a specific hash table identified by its key in a single operation. This function allows efficiently storing multiple related fields at once for a specific identifier, reducing the number of separate database calls required. It's ideal for saving a collection of player-specific or entity-specific data.
## Syntax
```sqf
[_data] call dragonfly_db_fnc_hashSetIdBulk
```
## Parameters
| Parameter | Type | Description | Default |
|-----------|-------|--------------------------------------------------------------------|---------|
| `_data` | Array | Array with key followed by alternating field names and values | [] |
## Return Value
None. The operation runs synchronously to store all the data.
## Examples
### Store player loadout and position:
```sqf
[[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call dragonfly_db_fnc_hashSetIdBulk;
```
### Store multiple vehicle properties:
```sqf
[["vehicle_123", "fuel", [0.75], "damage", [0.2], "crew", [["player1", "player2"]]]] call dragonfly_db_fnc_hashSetIdBulk;
```
### Store player data from a client:
```sqf
[[getPlayerUID player, "stats", [score player], "inventory", [getAllGear player]]] remoteExecCall ["dragonfly_db_fnc_hashSetIdBulk", 2, false];
```
## Notes
- The data array must be structured with the key first, followed by alternating field names and values: `[key, field1, value1, field2, value2, ...]`
- The key must be a string that identifies the specific hash table
- Each field name must be a string
- Values can be arrays, strings, numbers, or booleans
- All field-value pairs are stored in a single database operation
- If the hash table doesn't exist, it will be created automatically
- If any of the fields already exist in the hash table, their values will be overwritten
- More efficient than multiple individual `hashSetId` calls when setting several fields
- Player UIDs are commonly used as keys to store player-specific data
- The operation is executed immediately and synchronously
- All operations are logged for debugging purposes
## Related Functions
- `dragonfly_db_fnc_hashSetId`: Sets a single field value in a specific hash table
- `dragonfly_db_fnc_hashSetBulk`: Sets multiple field-value pairs in the global hash table
- `dragonfly_db_fnc_hashGetAllId`: Retrieves all fields from a specific hash table
- `dragonfly_db_fnc_hashGetId`: Retrieves a specific field value from a specific hash table
## Links
[Hash Get](hashGet.md) |
[Hash Get All](hashGetAll.md) |
[Hash Get All ID](hashGetAllId.md) |
[Hash Get ID](hashGetId.md) |
[Hash Set](hashSet.md) |
[Hash Set Bulk](hashSetBulk.md) |
[Hash Set ID](hashSetId.md) |
[Hash Set ID Bulk](hashSetIdBulk.md)