Commit Graph

2 Commits

Author SHA1 Message Date
Thomas Stephenson e07097ddd2 Fix errors from initial CE run
- fix mypy and linter issues
- expand BitString tests for int and bytes conversion
- Only run BIT test types on postgresql dialect
- Fix problems in `BitString.from_int` and `BitString.from_bytes`
- Add `BitString.to_bytes` method to allow specifying the byte
  length of the returned instances
- Fixed problems testing operators in BIT type tests
2025-05-16 19:31:07 +10:00
Thomas Stephenson 7617485827 10556: Create new BitString subclass for bitstrings for PG drivers
- Added custom `BitString` implementation which inherits from `str`
  and overrides methods and operators appropriately and
  implements the bitwise operations in a manner consistent with
  postgresql. Also exposes class and instance methods ensuring
  instances can be converted to/from `int` and `bytes` sensibly.

- Added default implementations of `bind_processor` and
  `result_processor` to `postgresql.BIT` type to convert `BitString`
  to/from string for PG drivers.

- Override `bind_processor` and `result_processor` in AsyncpgBit
  in order to convert `BitString` to/from `asynpg.BitString`
  in `asyncpg` driver.

- Added support for bitwise comparators to postgresql `BIT` instances

Fixes: 10556
2025-05-15 23:21:49 +10:00