mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-28 06:09:59 +03:00
replacing the old opDispatch now that some dmd bugs are fixed
This commit is contained in:
parent
7560c68548
commit
e9e25a08d4
1 changed files with 26 additions and 0 deletions
26
database.d
26
database.d
|
@ -667,7 +667,33 @@ class DataObject {
|
||||||
string[string][string] multiTableKeys; // note this is not set internally tight now
|
string[string][string] multiTableKeys; // note this is not set internally tight now
|
||||||
// but it can be set manually to do multi table mappings for automatic update
|
// but it can be set manually to do multi table mappings for automatic update
|
||||||
|
|
||||||
|
|
||||||
|
string opDispatch(string field, string file = __FILE__, size_t line = __LINE__)()
|
||||||
|
if((field.length < 8 || field[0..8] != "id_from_") && field != "popFront")
|
||||||
|
{
|
||||||
|
if(field !in fields)
|
||||||
|
throw new Exception("no such field " ~ field, file, line);
|
||||||
|
|
||||||
|
return fields[field];
|
||||||
|
}
|
||||||
|
|
||||||
|
string opDispatch(string field, T)(T t)
|
||||||
|
if((field.length < 8 || field[0..8] != "id_from_") && field != "popFront")
|
||||||
|
{
|
||||||
|
static if(__traits(compiles, t is null)) {
|
||||||
|
if(t is null)
|
||||||
|
setImpl(field, null);
|
||||||
|
else
|
||||||
|
setImpl(field, to!string(t));
|
||||||
|
} else
|
||||||
|
setImpl(field, to!string(t));
|
||||||
|
|
||||||
|
return fields[field];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// vararg hack so property assignment works right, even with null
|
// vararg hack so property assignment works right, even with null
|
||||||
|
version(none)
|
||||||
string opDispatch(string field, string file = __FILE__, size_t line = __LINE__)(...)
|
string opDispatch(string field, string file = __FILE__, size_t line = __LINE__)(...)
|
||||||
if((field.length < 8 || field[0..8] != "id_from_") && field != "popFront")
|
if((field.length < 8 || field[0..8] != "id_from_") && field != "popFront")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue