Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions docs/reference/messages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,3 @@ print(msg.query_string) # SELECT 1
| [Errors and Notices](errors.md) | `ErrorResponse`, `NoticeResponse`, `NotificationResponse`, `ParameterStatus` |
| [Miscellaneous](misc.md) | `BackendKeyData`, `FunctionCall`, `Terminate`, `NegotiateProtocolVersion` |

## Lookup functions

Look up message classes by their wire protocol identifier:

```python
from pygwire.messages import lookup_backend, lookup_frontend, lookup_special

# Look up by single-byte identifier
msg_cls = lookup_backend(b"T") # RowDescription
msg_cls = lookup_frontend(b"Q") # Query

# Look up startup messages by version code
msg_cls = lookup_special(0x00030000) # StartupMessage (v3.0)
```

```python
lookup_backend(identifier: bytes) -> type[BackendMessage] | None
lookup_frontend(identifier: bytes) -> type[FrontendMessage] | None
lookup_special(version_code: int) -> type[SpecialMessage] | None
```

Returns `None` if no message matches.
Loading