psycopg

class litestar.channels.backends.psycopg.PsycoPgChannelsBackend[原始碼]

基底類別:ChannelsBackend

__init__(pg_dsn: str) None[原始碼]
async on_startup() None[原始碼]

Called by the plugin on application startup

async on_shutdown() None[原始碼]

Called by the plugin on application shutdown

async publish(data: bytes, channels: Iterable[str]) None[原始碼]

Publish the message data to all channels

async subscribe(channels: Iterable[str]) None[原始碼]

Start listening for events on channels

async unsubscribe(channels: Iterable[str]) None[原始碼]

Stop listening for events on channels

async stream_events() AsyncGenerator[tuple[str, bytes], None][原始碼]

Return a generator, iterating over events of subscribed channels as they become available

async get_history(channel: str, limit: int | None = None) list[bytes][原始碼]

Return the event history of channel, at most limit entries