Fix ModelKeyType structure fields alignment.
This commit is contained in:
parent
28bef7ef42
commit
26c854a39c
1 changed files with 5 additions and 2 deletions
|
@ -50,12 +50,15 @@ pub fn ModelKeyType(comptime Model: type, comptime TableShape: type, comptime co
|
||||||
var fieldName: [keyName.len:0]u8 = undefined;
|
var fieldName: [keyName.len:0]u8 = undefined;
|
||||||
@memcpy(fieldName[0..keyName.len], keyName);
|
@memcpy(fieldName[0..keyName.len], keyName);
|
||||||
|
|
||||||
|
// Get current field type.
|
||||||
|
const fieldType = std.meta.fields(TableShape)[std.meta.fieldIndex(TableShape, keyName).?].type;
|
||||||
|
|
||||||
field.* = .{
|
field.* = .{
|
||||||
.name = &fieldName,
|
.name = &fieldName,
|
||||||
.type = std.meta.fields(TableShape)[std.meta.fieldIndex(TableShape, keyName).?].type,
|
.type = fieldType,
|
||||||
.default_value = null,
|
.default_value = null,
|
||||||
.is_comptime = false,
|
.is_comptime = false,
|
||||||
.alignment = 0,
|
.alignment = @alignOf(fieldType),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue