Skip to content

Commit

Permalink
Added Database.escape() method and incrementing to version 1.0.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
whdev1 committed May 19, 2022
1 parent ba79be9 commit 5f42523
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
setup(
name = 'targa',
packages = ['targa', 'targa.errors'],
version = '1.0.4',
version = '1.0.5',
license='MIT',
description = 'A lightweight async Python library for MySQL queries and modeling.',
author = 'whdev1',
author_email = 'whdev1@protonmail.com',
url = 'https://github.com/whdev1/targa',
download_url = 'https://github.com/whdev1/targa/archive/refs/tags/v1.0.4.tar.gz',
download_url = 'https://github.com/whdev1/targa/archive/refs/tags/v1.0.5.tar.gz',
keywords = ['Targa', 'SQL', 'MySQL', 'async'],
install_requires=['aiomysql'],
classifiers=[
Expand Down
14 changes: 14 additions & 0 deletions targa/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ async def _ensure_connection(self) -> None:
else:
await self._connection.ping()

async def escape(self, raw_string: str) -> str:
"""
Escapes the specified raw string.
Parameters:
raw_string: str
The str to escape
Returns:
A str containing the escaped version of the raw string.
"""

return self._connection.escape_string(str(raw_string))

async def insert(self, model_inst: Model) -> None:
"""
Inserts the specified Targa model instance into the remote database as a new record.
Expand Down

0 comments on commit 5f42523

Please sign in to comment.