j1b1x/asyncmedoo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

j1b1x/asyncmedoo

Composer 安装命令:

composer require j1b1x/asyncmedoo

包简介

README 文档

README

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!"

统计信息

  • 总下载量: 335
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-05-28