ramdb/docs/hash/hashSetIdBulk.md
Jacob Schmidt 5b9f3402b6
All checks were successful
Build / Build (push) Successful in 30s
docs: add comprehensive documentation and usage examples for ramdb
2025-03-22 16:31:59 -05:00

3.0 KiB

title, icon, excerpt
title icon excerpt
ArmaRAMDb - Hash Set ID Bulk mdi:file-text-outline Set the specified fields to their respective values in the hash stored at key from RAMDb.

ramdb_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

[_data] call ramdb_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:

[[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call ramdb_db_fnc_hashSetIdBulk;

Store multiple vehicle properties:

[["vehicle_123", "fuel", [0.75], "damage", [0.2], "crew", [["player1", "player2"]]]] call ramdb_db_fnc_hashSetIdBulk;

Store player data from a client:

[[getPlayerUID player, "stats", [score player], "inventory", [getAllGear player]]] remoteExecCall ["ramdb_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
  • ramdb_db_fnc_hashSetId: Sets a single field value in a specific hash table
  • ramdb_db_fnc_hashSetBulk: Sets multiple field-value pairs in the global hash table
  • ramdb_db_fnc_hashGetAllId: Retrieves all fields from a specific hash table
  • ramdb_db_fnc_hashGetId: Retrieves a specific field value from a specific hash table
  • ramdb_db_fnc_hashDeleteId: Removes a specific hash table

Hash Delete | Hash Delete Field | Hash Delete ID | Hash Get | Hash Get All | Hash Get All ID | Hash Get ID | Hash Set | Hash Set Bulk | Hash Set ID | Hash Set ID Bulk