Base TableModel helpers on TableShape instead of Model.

This commit is contained in:
Madeorsk 2024-11-25 23:12:02 +01:00
parent 21a2e88295
commit 4782cbb37a
Signed by: Madeorsk
GPG key ID: 677E51CA765BB79F

View file

@ -3,7 +3,7 @@ const std = @import("std");
/// Simple ModelFromSql and ModelToSql functions for models which have the same table definition.
pub fn TableModel(comptime Model: type, comptime TableShape: type) type {
// 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 {
/// Simply copy all fields from model to table.