Skip to content

Commit ca4e7f8

Browse files
committed
fix _Uint64TimestampKeysMixin
1 parent 659d934 commit ca4e7f8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zlmdb/_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,17 +811,17 @@ def _serialize_key(self, key1_key2):
811811
if key2 is None:
812812
key2 = np.datetime64(0, 'ns')
813813

814-
assert type(key1) != int
815-
assert isinstance(key2, np.datetime64)
814+
assert type(key1) == int, 'key1 must be int, but was {}'.format(type(key1))
815+
assert isinstance(key2, np.datetime64), 'key2 must be np.datetime64, but was {}'.format(type(key2))
816816

817-
return struct.pack('>H', key1) + dt_to_bytes(key2)
817+
return struct.pack('>Q', key1) + dt_to_bytes(key2)
818818

819819
def _deserialize_key(self, data):
820820
assert type(data) == bytes
821821
assert len(data) == 16
822822

823823
data1, data2 = data[0:8], data[8:16]
824-
key1 = struct.unpack('>H', data1)[0]
824+
key1 = struct.unpack('>Q', data1)[0]
825825
key2 = bytes_to_dt(data2)
826826
return key1, key2
827827

0 commit comments

Comments
 (0)