parameter names current impl

This commit is contained in:
ookami125 2025-03-12 10:57:00 -04:00
parent 8e9dd559bd
commit 31de354ce4
4 changed files with 149 additions and 50 deletions

View file

@ -147,11 +147,11 @@ fn serialize_table_access(array: *std.ArrayList(u8), val: TableAccess) !void {
}
fn serialize_product_type_element(array: *std.ArrayList(u8), val: ProductTypeElement) !void {
try array.appendSlice(&[_]u8{ @intFromBool(val.name == null) });
if(val.name) |name| {
try array.appendSlice(&std.mem.toBytes(@as(u32, @intCast(name.len))));
try array.appendSlice(name);
}
try array.appendSlice(&[_]u8{ 0 });
//if(val.name) |name| {
try array.appendSlice(&std.mem.toBytes(@as(u32, @intCast(val.name.len))));
try array.appendSlice(val.name);
//}
try serialize_algebraic_type(array, val.algebraic_type);
}

View file

@ -1,3 +1,5 @@
const std = @import("std");
pub const Str = []const u8;
pub const SumTypeVariant = struct {
@ -110,7 +112,7 @@ pub const RawTableDefV9 = struct {
};
pub const ProductTypeElement = struct {
name: ?Str,
name: Str,
algebraic_type: AlgebraicType,
};
@ -124,11 +126,27 @@ pub const Lifecycle = enum {
OnDisconnect,
};
pub fn Table2Struct(comptime table_type: type) type {
_ = table_type;
return struct {
};
}
pub const Local = struct {
pub fn get(self: @This(), table: anytype) Table2Struct(@TypeOf(table)) {
_ = self;
return .{
//.name = "blahsss",
};
}
};
pub const ReducerContext = struct {
indentity: u256,
timestamp: u64,
connection_id: u128,
db: Local,
};
pub const ReducerFn = fn(*ReducerContext) void;