Metadata-Version: 2.1
Name: aiotorndb
Version: 0.2
Summary: asynchronous tornado database connection
Author-email: ResistanceTo <resistanceto@outlook.com>
Project-URL: Homepage, https://github.com/ResistanceTo/aiotorndb
Project-URL: Bug Tracker, https://github.com/ResistanceTo/aiotorndb/issues
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

[torndb](https://github.com/bdarnell/torndb) rewrite to asynchronous

## Example

First get a connection object

```python
from aiotorndb import Connection

conn = Connection(
    host="127.0.0.1",
    db="test",
    user="root",
    password="123456",
    port=3306,
    time_zone="+8:00",
    charset="utf8",
)
```

Next, you can use methods such as select, update, insert, delete, etc.

```python
import asyncio

async def test():
    get_result = await conn.get("select * from user where id = 1")
    print(get_result)
    # {'id': 1, 'name': 'tom'}

    select_result = await conn.select("select * from user")
    print(select_result)
    # [{'id': 1, 'name': 'tom'}, {'id': 2, 'name': 'ellis'}]

    update_result = await conn.update("update user set name = %(name)s where id = 1", name="eddie")
    print(update_result)
    # 1

    insert_result = await conn.insert("insert into user (name) values (%(name)s)", name="dav")
    print(insert_result)
    # 3

    # sql = select * from user where id in (1, 3)
    select_result2 = await conn.select("select * from user where id in %(user_ids)s", user_ids=[1, 3])
    print(select_result2)
    # [{'id': 1, 'name': 'eddie'}, {'id': 3, 'name': 'dav'}]

    # sql = select * from project_tag where name like '%e%'
    select_result3 = await conn.select("select * from project_tag where name like %(name)s", name="%e%")
    print(select_result3)
    # [{'id': 1, 'name': 'eddie'}, {'id': 2, 'name': 'ellis'}]

asyncio.run(test())
```
