From 652fe2f3d43891b82fa370fa5720aed6e3205d89 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Thu, 21 Apr 2022 22:06:41 +0200 Subject: check explicitly that bindField is implemented --- sqlite.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sqlite.zig') diff --git a/sqlite.zig b/sqlite.zig index f434a61..d45bda3 100644 --- a/sqlite.zig +++ b/sqlite.zig @@ -1653,7 +1653,13 @@ pub const DynamicStatement = struct { } }, .Struct => { - try self.bindField(FieldType.BaseType, options, field_name, i, try field.bindField(options.allocator)); + if (!comptime std.meta.trait.hasFn("bindField")(FieldType)) { + @compileError("cannot bind field " ++ field_name ++ " of type " ++ @typeName(FieldType) ++ ", consider implementing the bindField() method"); + } + + const field_value = try field.bindField(options.allocator); + + try self.bindField(FieldType.BaseType, options, field_name, i, field_value); }, else => @compileError("cannot bind field " ++ field_name ++ " of type " ++ @typeName(FieldType)), }, -- cgit v1.2.3