Encode a mapping type.
(name: bytes, value: Any, check_keys: bool, opts: CodecOptions[Any])
| 711 | |
| 712 | |
| 713 | def _encode_mapping(name: bytes, value: Any, check_keys: bool, opts: CodecOptions[Any]) -> bytes: |
| 714 | """Encode a mapping type.""" |
| 715 | if _raw_document_class(value): |
| 716 | return b"\x03" + name + cast(bytes, value.raw) |
| 717 | data = b"".join([_element_to_bson(key, val, check_keys, opts) for key, val in value.items()]) |
| 718 | return b"\x03" + name + _PACK_INT(len(data) + 5) + data + b"\x00" |
| 719 | |
| 720 | |
| 721 | def _encode_dbref(name: bytes, value: DBRef, check_keys: bool, opts: CodecOptions[Any]) -> bytes: |
nothing calls this directly
no test coverage detected