Skip to content

v0.1.4

Compare
Choose a tag to compare
@Vastxiao Vastxiao released this 13 Oct 08:35
· 20 commits to main since this release
a819860

Features

1.AsMysql支持异步上下文管理器。

import asyncio
from asmysql import AsMysql

class TestAsMysql(AsMysql):
    async def get_users(self):
        result = await self.client.execute('select user,authentication_string,host from mysql.user')
        if result.err:
            print(result.err)
        else:
            async for item in result.iterate():
                print(item)

async def main():
    async with TestAsMysql() as mysql:
        await mysql.get_users()

if __name__ == '__main__':
    asyncio.run(main())