brouznouf / fivem-mysql-async

MySql Async Library for FiveM
MIT License
111 stars 106 forks source link

Added JavaScript support #195

Open LeBogoo opened 2 years ago

LeBogoo commented 2 years ago

I have added JavaScript support. Since JavaScript Async/Await always returns a Promise, I added an Async and a callback way for each function.

Async/Await way:

await MySQL.Async.fetchAll("SELECT * FROM players" , {});

Callback way:

MySQL.fetchAll("SELECT * FROM players" , {}, function (results) {
    ...
});

I have also updated the documentation for the JavaScript variant.