Base TableModel helpers on TableShape instead of Model.
This commit is contained in:
parent
21a2e88295
commit
4782cbb37a
1 changed files with 1 additions and 1 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.
|
||||||
|
|
Loading…
Reference in a new issue