Compare commits
2 commits
21a2e88295
...
fc6cbaa2b9
Author | SHA1 | Date | |
---|---|---|---|
fc6cbaa2b9 | |||
4782cbb37a |
2 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@ const std = @import("std");
|
||||||
/// Simple ModelFromSql and ModelToSql functions for models which have the same table definition.
|
/// Simple ModelFromSql and ModelToSql functions for models which have the same table definition.
|
||||||
pub fn TableModel(comptime Model: type, comptime TableShape: type) type {
|
pub fn TableModel(comptime Model: type, comptime TableShape: type) type {
|
||||||
// Get fields of the model, which must be the same as the table shape.
|
// Get fields of the model, which must be the same as the table shape.
|
||||||
const fields = std.meta.fields(Model);
|
const fields = std.meta.fields(TableShape);
|
||||||
|
|
||||||
return struct {
|
return struct {
|
||||||
/// Simply copy all fields from model to table.
|
/// Simply copy all fields from model to table.
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn TableWithRelations(comptime TableShape: type, comptime MetadataShape: ?ty
|
||||||
.Struct = .{
|
.Struct = .{
|
||||||
.layout = tableType.Struct.layout,
|
.layout = tableType.Struct.layout,
|
||||||
.fields = &fields,
|
.fields = &fields,
|
||||||
.decls = tableType.Struct.decls,
|
.decls = &[0]std.builtin.Type.Declaration{},
|
||||||
.is_tuple = tableType.Struct.is_tuple,
|
.is_tuple = tableType.Struct.is_tuple,
|
||||||
.backing_integer = tableType.Struct.backing_integer,
|
.backing_integer = tableType.Struct.backing_integer,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue