mirror of https://github.com/adamdruppe/arsd.git
Merge pull request #346 from vabenil/add_assert_to_find
Add integral field check to find
This commit is contained in:
commit
25c0da9c45
|
@ -409,6 +409,9 @@ static auto find(alias T)(Database db, int id) {
|
||||||
alias TType = T;
|
alias TType = T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static assert(is(FType : int),
|
||||||
|
TType.stringof ~ "." ~ fieldName ~ " should be an Integral field");
|
||||||
|
|
||||||
string q = "SELECT * FROM " ~ tableNameFor!TType() ~ " WHERE " ~ fieldName ~ " = ?";
|
string q = "SELECT * FROM " ~ tableNameFor!TType() ~ " WHERE " ~ fieldName ~ " = ?";
|
||||||
foreach(record; db.query(q, id)) {
|
foreach(record; db.query(q, id)) {
|
||||||
TType t;
|
TType t;
|
||||||
|
|
Loading…
Reference in New Issue