File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ cdef class ReadBuffer:
113
113
cdef bytes read_bytes(self , ssize_t nbytes)
114
114
cdef bytes read_len_prefixed_bytes(self )
115
115
cdef str read_len_prefixed_utf8(self )
116
+ cdef read_uuid(self )
117
+ cdef inline int64_t read_int64(self ) except ? - 1
116
118
cdef inline int32_t read_int32(self ) except ? - 1
117
119
cdef inline int16_t read_int16(self ) except ? - 1
118
120
cdef inline read_null_str(self )
Original file line number Diff line number Diff line change @@ -420,6 +420,18 @@ cdef class ReadBuffer:
420
420
else :
421
421
return self .read_len_prefixed_bytes().decode(' utf-8' )
422
422
423
+ cdef read_uuid(self ):
424
+ cdef:
425
+ bytes mem
426
+ const char * cbuf
427
+
428
+ self ._ensure_first_buf()
429
+ cbuf = self ._try_read_bytes(16 )
430
+ if cbuf != NULL :
431
+ return pg_uuid_from_buf(cbuf)
432
+ else :
433
+ return pg_UUID(self .read_bytes(16 ))
434
+
423
435
cdef inline char read_byte(self ) except ? - 1 :
424
436
cdef const char * first_byte
425
437
@@ -435,6 +447,19 @@ cdef class ReadBuffer:
435
447
436
448
return first_byte[0 ]
437
449
450
+ cdef inline int64_t read_int64(self ) except ? - 1 :
451
+ cdef:
452
+ bytes mem
453
+ const char * cbuf
454
+
455
+ self ._ensure_first_buf()
456
+ cbuf = self ._try_read_bytes(8 )
457
+ if cbuf != NULL :
458
+ return hton.unpack_int64(cbuf)
459
+ else :
460
+ mem = self .read_bytes(8 )
461
+ return hton.unpack_int64(cpython.PyBytes_AS_STRING(mem))
462
+
438
463
cdef inline int32_t read_int32(self ) except ? - 1 :
439
464
cdef:
440
465
bytes mem
You can’t perform that action at this time.
0 commit comments