https://github.com/oxince/fivem-json-db
A flexible Lua database module designed for use in the FiveM platform.
https://github.com/oxince/fivem-json-db
fivem json local-database
Last synced: 4 months ago
JSON representation
A flexible Lua database module designed for use in the FiveM platform.
- Host: GitHub
- URL: https://github.com/oxince/fivem-json-db
- Owner: oxince
- License: mit
- Created: 2023-08-07T04:03:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-07T04:10:22.000Z (almost 3 years ago)
- Last Synced: 2025-07-24T03:53:13.132Z (11 months ago)
- Topics: fivem, json, local-database
- Language: Lua
- Homepage:
- Size: 3.91 KB
- Stars: 9
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lua Database Module for FiveM
A flexible Lua database module designed for use in the FiveM platform. This module provides functionalities to manage collections of data in a database-like manner, including saving, loading, updating, deleting, searching, and more.
## Features
- Create, manage, and manipulate data collections.
- Efficiently save and load collection data using JSON encoding/decoding.
- Optional timed auto-save functionality.
- Debugging support with customizable logging.
## Documentation
For detailed usage instructions and function documentation, refer to the [API documentation](API_DOCUMENTATION.md).
## Usage
1. **Installation**: Add the `database.lua` file and include it in your FiveM resource by adding `server_script "@fivem-json-db/server/database.lua"` to your resource manifest.
2. **Usage Example**:
```lua
local db = Database.new("resource_name", "path/to/database", true, true, 60000, true)
-- Initialize with collections
db:init({"players", "items", "quests"})
-- Insert data into a collection
db:insert("players", "player123", { name = "John", level = 10 })
-- Update data in a collection
db:update("players", "player123", { level = 11 })
-- Get data from a collection
local playerData = db:get("players", "player123")
-- Search for data in a collection
local playersWithLevel10 = db:searchAll("players", "level", 10)
-- ... and more (see documentation for all available functions)
```
## Contributions
Contributions are welcome! If you find any issues or have improvements to suggest, feel free to submit a pull request or open an issue.
## License
This project is licensed under the [MIT License](LICENSE).
---
*Disclaimer: This module is intended for educational purposes and might need further customization to meet production-level requirements.*