Compare commits
No commits in common. "fc6cbaa2b9ff35e17cfa3fb1669e9c7e4e357bb7" and "21a2e88295e04132e776dbfa6acd0734779bbd5e" have entirely different histories.
fc6cbaa2b9
...
21a2e88295
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(TableShape);
|
const fields = std.meta.fields(Model);
|
||||||
|
|
||||||
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 = &[0]std.builtin.Type.Declaration{},
|
.decls = tableType.Struct.decls,
|
||||||
.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