zig-sqlite
zig-sqlite copied to clipboard
Idea to handle text and blob internally
I haven't thought this through, but what if we could do something like this to distinguish between text and blob internally:
pub const Type = union(TypeTag) {
blob: std.builtin.Type.Pointer,
text: std.builtin.Type.Pointer,
...
pub fn parse(comptime T: type) Type {
return switch (T) {
else => switch (@typeInfo(T)) {
...
.Pointer => |info| {
if (info.is_const) {
return .{ .text = info };
} else {
return .{ .blob = info };
}
},
...
},
};
}
};
We can then remove Text, text, Blob and blob...