Skip to content

A PocketMine-MP library that allows you to execute PDO statements async using Medoo

Notifications You must be signed in to change notification settings

J1b1x/AsyncMedoo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsyncMedoo

php api

A PocketMine-MP virion to execute PDO statements async using Medoo

Initialization

First you need to initialize the MySQL credentials, so just do:

\Jibix\AsyncMedoo\AsyncMedoo::initialize(new \Jibix\AsyncMedoo\MySQLCredentials(
    "database",
    "password",
    "user",
    "address",
    3306 //port
));

Using the AsyncExecutor

Instead of manually starting an async task, you can simply use the async function, which automatically executes the provided task in the AsyncExecutor

private function dumpCoins(string $playerName): void{
    \Jibix\AsyncMedoo\util\async(
        fn (\Medoo\Medoo $medoo): int => $medoo->get("users", ["coins"], ["name" => $playerName]),
        function (int $coins) use ($playerName): void{
            var_dump("$playerName has $coins coins!");
        }
    );
}

$this->dumpCoins("Jibix YT"); //Output: "Jibix YT has 100 coins!"

About

A PocketMine-MP library that allows you to execute PDO statements async using Medoo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages