Support jsonb, idle_timeout, connection_timeout, max_lifetime timeouts in bun:sql. Add onopen and onclose callbacks. Fix missing "code" property appearing in errors. Add error codes for postgres. (#16045)

This commit is contained in:
Jarred Sumner
2024-12-30 13:25:01 -08:00
committed by GitHub
parent f0073bfa81
commit 76bfceae81
15 changed files with 1152 additions and 347 deletions

View File

@@ -323,6 +323,12 @@ pub const String = extern struct {
extern fn BunString__fromUTF16ToLatin1(bytes: [*]const u16, len: usize) String;
extern fn BunString__fromLatin1Unitialized(len: usize) String;
extern fn BunString__fromUTF16Unitialized(len: usize) String;
extern fn BunString__toInt32(this: String) i64;
pub fn toInt32(this: String) ?i32 {
const val = BunString__toInt32(this);
if (val > std.math.maxInt(i32)) return null;
return @intCast(val);
}
pub fn ascii(bytes: []const u8) String {
return String{ .tag = .ZigString, .value = .{ .ZigString = ZigString.init(bytes) } };