Fonctionnalites
Tout ce dont tu as besoin pour gerer ta base de donnees sur FiveM.
CRUD
create, find, update, delete — OrvexORM genere le SQL automatiquement.
Relations
hasOne, hasMany, belongsTo, belongsToMany avec attach/detach.
Query Builder
Chainable. WHERE, LIKE, IN, BETWEEN, JOIN, GROUP BY, ORDER BY.
Migrations
Cree tes tables avec sync() ou des migrations versionnees.
Cache
Cache TTL integre avec invalidation automatique sur les ecritures.
JSON
Colonnes JSON et auto-detection. Tables Lua converties automatiquement.
MODELES
Definis, cree, utilise
Un modele = une table. Le SQL est genere automatiquement.
local User = OrvexORM.model("users", {
identifier = "string",
money = "number",
job = "string",
position = "json",
}, { primaryKey = "identifier" })
User.sync()
local player = User.create({
identifier = "license:abc",
money = 500,
job = "unemployed",
position = { x = 0, y = 0, z = 0 },
})
REQUETES
Query builder chainable
Filtres, tri, pagination, jointures, aggregations, relations.
local richCops = User.query()
:where({ job = "police" })
:where("money", ">", 1000)
:orderBy("money", "DESC")
:limit(10)
:get()
local avgMoney = User.avg("money")
local totalCops = User.count({ job = "police" })
User.hasMany("vehicles", Vehicle, {
foreignKey = "owner"
})
local cars = player:get("vehicles")