Skip to content

Commit

Permalink
rename a method
Browse files Browse the repository at this point in the history
  • Loading branch information
imryche committed Jun 30, 2024
1 parent 6fdd353 commit b763696
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions litequery/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ def __init__(self, database, queries):

def _create_method(self, query: Query):
async def query_method(**kwargs):
conn = await self.conn()
conn = await self.get_connection()
async with conn.execute(query.sql, kwargs) as cur:
if query.op == Op.SELECT:
return await cur.fetchall()
if query.op == Op.INSERT:
await conn.commit()
return cur.rowcount

return query_method
Expand All @@ -83,7 +84,7 @@ async def disconnect(self):
return
await self._conn.close()

async def conn(self):
async def get_connection(self):
if self._conn is None:
await self.connect()
return self._conn

0 comments on commit b763696

Please sign in to comment.