-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlpp11dv3.d
More file actions
executable file
·35 lines (30 loc) · 965 Bytes
/
sqlpp11dv3.d
File metadata and controls
executable file
·35 lines (30 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env tdmd
import std.conv : to;
/// sqlpp11dv3 - query builder with some Compile Time Function Evaluation (CTFE)
unittest {
alias QueryBuilder = QueryBuilderCTFE;
static assert(
QueryBuilder
.select("foo", "bar")
.from("bazTable")
.where_equal("foo", "42".to!string)
== "select foo, bar from bazTable where foo='42'"
);
// static asserts are asserts at compile time
assert(
QueryBuilder
.select("foo", "bar")
.from("bazTable")
.where_equal("foo", 42.to!int)
== "select foo, bar from bazTable where foo='42'"
);
assert(
QueryBuilder
.select("foo", "bar")
.from("bazTable")
.where_equal("foo", true.to!bool)
== "select foo, bar from bazTable where foo='true'"
);
}
import sqlpp11dv2 : QueryBuilderWithTemplates;
alias QueryBuilderCTFE = QueryBuilderWithTemplates;