Skip to content

Commit bcd96f3

Browse files
committed
LISTEN/NOTIFY funcionality
Signed-off-by: chandr-andr (Kiselev Aleksandr) <[email protected]>
1 parent d5d4458 commit bcd96f3

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

python/psqlpy/_internal/__init__.pyi

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,46 +1775,45 @@ class Listener:
17751775
self: Self,
17761776
channel: str,
17771777
callback: Callable[
1778-
[str, str, int, Connection], Awaitable[None],
1778+
[str, str, int, Connection],
1779+
Awaitable[None],
17791780
],
17801781
) -> None:
17811782
"""Add callback to the channel.
1782-
1783+
17831784
Callback must be async function and have signature like this:
17841785
```python
17851786
async def callback(
17861787
channel: str,
17871788
payload: str,
17881789
process_id: str,
17891790
connection: Connection,
1790-
) -> None:
1791-
...
1791+
) -> None: ...
17921792
```
17931793
"""
1794-
1794+
17951795
async def clear_channel_callbacks(self, channel: str) -> None:
17961796
"""Remove all callbacks for the channel.
1797-
1797+
17981798
### Parameters:
17991799
- `channel`: name of the channel.
18001800
"""
18011801

18021802
async def listen(self: Self) -> None:
18031803
"""Start listening.
18041804
1805-
Start actual listening.
1806-
In the background it creates task in Rust event loop.
1805+
Start actual listening.
1806+
In the background it creates task in Rust event loop.
18071807
You must save returned Future to the array.
18081808
"""
18091809

18101810
async def abort_listen(self: Self) -> None:
18111811
"""Abort listen.
1812-
1813-
If `listen()` method was called, stop listening,
1812+
1813+
If `listen()` method was called, stop listening,
18141814
else don't do anything.
18151815
"""
18161816

1817-
18181817
class ListenerNotificationMsg:
18191818
"""Listener message in async iterator."""
18201819

0 commit comments

Comments
 (0)
close