
All checks were successful
Build / Build (push) Successful in 39s
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.
68 lines
3.0 KiB
Markdown
68 lines
3.0 KiB
Markdown
---
|
|
title: ArmaDragonflyClient - Add Task
|
|
icon: mdi:file-text-outline
|
|
excerpt: Add task to queue.
|
|
---
|
|
|
|
# dragonfly_db_fnc_addTask
|
|
|
|
## Description
|
|
Adds a task to the database operation queue. This function is used to schedule database operations that can be processed sequentially, providing a way to manage multiple database requests in an organized manner.
|
|
|
|
## Syntax
|
|
```sqf
|
|
[_taskType, _key, _keyField, _index, _value, _function, _call, _netId] call dragonfly_db_fnc_addTask
|
|
```
|
|
|
|
## Parameters
|
|
| Parameter | Type | Description | Default |
|
|
|-------------|----------------------------------|----------------------------------------------------|---------|
|
|
| `_taskType` | String | Type of operation to perform (e.g., "hgetall") | "" |
|
|
| `_key` | String | Name of the stored key | "" |
|
|
| `_keyField` | String | Field name for hash operations | "" |
|
|
| `_index` | Number | Index for list operations | -1 |
|
|
| `_value` | Array, String, Number, or Boolean| Value to store (for set operations) | [] |
|
|
| `_function` | String | Name of function to call with the result | "" |
|
|
| `_call` | Boolean | Whether to call the function directly (true) or spawn (false) | false |
|
|
| `_netId` | String | NetID of the target to receive the result | "" |
|
|
|
|
## Return Value
|
|
None. The task is added to the queue and processed asynchronously.
|
|
|
|
## Examples
|
|
### Add a hash table retrieval task:
|
|
```sqf
|
|
["hgetall", "", "", -1, [], "dragonfly_db_fnc_test"] call dragonfly_db_fnc_addTask;
|
|
```
|
|
|
|
### Add a player-specific task that returns data to a specific client:
|
|
```sqf
|
|
["hgetallid", getPlayerUID player, "", -1, [], "dragonfly_db_fnc_test", false, netId player] remoteExecCall ["dragonfly_db_fnc_addTask", 2, false];
|
|
```
|
|
|
|
### Add a list operation task:
|
|
```sqf
|
|
["listadd", "playerMessages", "", -1, ["New message content"], ""] call dragonfly_db_fnc_addTask;
|
|
```
|
|
|
|
## Notes
|
|
- Tasks are processed in the order they are added to the queue
|
|
- If the queue is not currently being processed, this function will start the processing
|
|
- The task type determines which database operation will be performed
|
|
- This function is particularly useful for scheduling multiple related operations
|
|
- All operations performed through the task queue are logged for debugging
|
|
|
|
## Related Functions
|
|
- `dragonfly_db_fnc_processQueue`: Processes the pending tasks in the queue
|
|
- `dragonfly_db_fnc_handler`: Handles the results of completed database operations
|
|
- `dragonfly_db_fnc_scheduler`: Manages callback responses from the database
|
|
|
|
## Links
|
|
|
|
[Add Task](addTask.md) |
|
|
[Handler](handler.md) |
|
|
[Init](init.md) |
|
|
[Print Addon Name](printAddonName.md) |
|
|
[Process Queue](processQueue.md) |
|
|
[Scheduler](scheduler.md) |
|
|
[Test](test.md) |