async def user_exists(user_id):
conn = await asyncpg.connect(host=host, user=user, password=password, database=database)
try: return await conn.fetchrow(f"SELECT 1 FROM users WHERE (user_id=} LIMIT 1")
finally: await conn.close()
async def my_func(value: object):
some code
return x
async def my_func2():
while True:
y = await my_func(some_object)
if y == z:
break
yield y
async def my_func3():
async for i in my_func2():
print(i)