mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
refactor(postgres) improve postgres code base (#20808)
Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com>
This commit is contained in:
20
src/sql/postgres/protocol/BackendKeyData.zig
Normal file
20
src/sql/postgres/protocol/BackendKeyData.zig
Normal file
@@ -0,0 +1,20 @@
|
||||
process_id: u32 = 0,
|
||||
secret_key: u32 = 0,
|
||||
pub const decode = DecoderWrap(BackendKeyData, decodeInternal).decode;
|
||||
|
||||
pub fn decodeInternal(this: *@This(), comptime Container: type, reader: NewReader(Container)) !void {
|
||||
if (!try reader.expectInt(u32, 12)) {
|
||||
return error.InvalidBackendKeyData;
|
||||
}
|
||||
|
||||
this.* = .{
|
||||
.process_id = @bitCast(try reader.int4()),
|
||||
.secret_key = @bitCast(try reader.int4()),
|
||||
};
|
||||
}
|
||||
|
||||
// @sortImports
|
||||
|
||||
const BackendKeyData = @This();
|
||||
const DecoderWrap = @import("./DecoderWrap.zig").DecoderWrap;
|
||||
const NewReader = @import("./NewReader.zig").NewReader;
|
||||
Reference in New Issue
Block a user