
All checks were successful
Build / Build (push) Successful in 30s
This commit introduces the ability to delete lists within the ArmaRAMDb extension. It also refactors the parameter handling in several sqf functions to improve consistency and remove unnecessary data structures. Specifically, the following changes were made: * **Extension (C#):** * Added `ListDeleteAsync` to `ListStore.cs` to handle list deletion. * Added a "listdel" case to `Main.cs` to call the new `HandleListDelOperation` function. * Created `HandleListDelOperation` to call `ListStore.ListDeleteAsync`. * Removed unused parameters from `HandleHDelOperation`. * **SQF Functions:** * Updated `fnc_hashSetIdBulk.sqf`, `fnc_hashSetBulk.sqf`, `fnc_hashSetId.sqf`, `fnc_listSet.sqf`, `fnc_hashSet.sqf`, `fnc_listAdd.sqf`, and `fnc_set.sqf` to use a simpler parameter structure. Specifically, the `_data` parameter is now expected to be a simple array instead of an array containing a default value. * **XEH_PREP.hpp:** * Added a few new functions to register. * **Examples:** * Updated examples in `fnc_hashSetIdBulk.sqf` and `fnc_hashSetBulk.sqf` to reflect the parameter changes. This change enhances the functionality of ArmaRAMDb by providing a mechanism to remove lists and improves the overall code quality and consistency.
4.8 KiB
4.8 KiB
ArmaRAMDb Documentation
This documentation provides details on all functions available in ArmaRAMDb
. These functions allow you to interact with the in-memory database system for Arma 3.
Function Categories
The functions are categorized by their purpose:
Core Functions
- init - Initialize the database system
- handler - Handle callbacks from the extension
- processQueue - Process queued database operations
- scheduler - Schedule database operations
- addTask - Add a task to the scheduler
- printAddonName - Print the addon name
- test - Test the database connection
Basic Data Operations
- get - Get a value from the database
- set - Set a value in the database
- delete - Delete a value from the database
- save - Save the database to disk
- load - Load the database from disk
- fetch - Fetch a value from the database
Hash Operations
- hashDelete - Delete a hash
- hashDeleteId - Delete a hash for a specific ID
- hashGet - Get a field from a hash
- hashGetAll - Get all fields from a hash
- hashGetAllId - Get all fields from a hash for a specific ID
- hashGetId - Get a field from a hash for a specific ID
- hashRemove - Remove a field from a hash
- hashRemoveId - Remove a field from a hash for a specific ID
- hashSet - Set a field in a hash
- hashSetBulk - Set multiple fields in a hash in one operation
- hashSetId - Set a field in a hash for a specific ID
- hashSetIdBulk - Set multiple fields in a hash for a specific ID in one operation
List Operations
- listAdd - Add an item to a list
- listDelete - Delete a list
- listGet - Get items from a list
- listLoad - Load a list from the database
- listRemove - Remove an item from a list
- listSet - Set an item in a list
Usage Examples
Basic Usage
// Initialize the database
[] call ramdb_db_fnc_init;
// Set a value
["myKey", ["myValue"]] call ramdb_db_fnc_set;
// Get a value
["myKey", "myFunction"] call ramdb_db_fnc_get;
// Delete a key
["myKey"] call ramdb_db_fnc_delete;
Hash Operations
// Set a hash field (context mode)
["myField", [myValue]] call ramdb_db_fnc_hashSet;
// Get a hash field (context mode)
["myField", "myFunction"] call ramdb_db_fnc_hashGet;
// Get all hash fields (context mode)
["myFunction"] call ramdb_db_fnc_hashGetAll;
// Set multiple hash fields (context mode)
[[
"loadout", [getUnitLoadout player],
"position", [getPosASL player],
"direction", [getDir player],
"stance", [stance player]
]] call ramdb_db_fnc_hashSetBulk;
// Remove a hash field (context mode)
["myField"] call ramdb_db_fnc_hashRemove;
// Delete a hash table (context mode)
[] call ramdb_db_fnc_hashDelete;
// Set a hash field for specific ID
["myHash", "myField", [myValue]] call ramdb_db_fnc_hashSetId;
// Get a hash field for specific ID
["myHash", "myField", "myFunction"] call ramdb_db_fnc_hashGetId;
// Get all hash fields for specific ID
["myHash"] call ramdb_db_fnc_hashGetAllId;
// Set multiple hash fields for specific ID
[[
getPlayerUID player,
"loadout", [getUnitLoadout player],
"position", [getPosASL player],
"direction", [getDir player],
"stance", [stance player]
]] call ramdb_db_fnc_hashSetIdBulk;
// Remove a hash field for specific ID
["myHash", "myField"] call ramdb_db_fnc_hashRemoveId;
// Delete a hash table for specific ID
["myHash"] call ramdb_db_fnc_hashDeleteId;
List Operations
// Add an item to a list
["myList", ["myItem"]] call ramdb_db_fnc_listAdd;
// Set an item from a list
["myList", 0, [myNewValue]] call ramdb_db_fnc_listSet;
// Get an item from a list
["myList", 0, "myFunction"] call ramdb_db_fnc_listGet;
// Get items from a list
["myList", "myFunction"] call ramdb_db_fnc_listLoad;
// Remove an item from a list
["myList", 0] call ramdb_db_fnc_listRemove;
// Delete a list
["myList"] call ramdb_db_fnc_listDelete;
Function Documentation Structure
Each function documentation includes:
- Function name and purpose
- Parameters
- Return value
- Examples
- Notes and warnings
License
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons,
PO Box 1866, Mountain View, CA 94042