mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
refactor(postgres) improve postgres code base (#20808)
Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com>
This commit is contained in:
22
src/sql/postgres/protocol/ArrayList.zig
Normal file
22
src/sql/postgres/protocol/ArrayList.zig
Normal file
@@ -0,0 +1,22 @@
|
||||
array: *std.ArrayList(u8),
|
||||
|
||||
pub fn offset(this: @This()) usize {
|
||||
return this.array.items.len;
|
||||
}
|
||||
|
||||
pub fn write(this: @This(), bytes: []const u8) AnyPostgresError!void {
|
||||
try this.array.appendSlice(bytes);
|
||||
}
|
||||
|
||||
pub fn pwrite(this: @This(), bytes: []const u8, i: usize) AnyPostgresError!void {
|
||||
@memcpy(this.array.items[i..][0..bytes.len], bytes);
|
||||
}
|
||||
|
||||
pub const Writer = NewWriter(@This());
|
||||
|
||||
// @sortImports
|
||||
|
||||
const ArrayList = @This();
|
||||
const std = @import("std");
|
||||
const AnyPostgresError = @import("../AnyPostgresError.zig").AnyPostgresError;
|
||||
const NewWriter = @import("./NewWriter.zig").NewWriter;
|
||||
Reference in New Issue
Block a user