mirror of https://github.com/Hax-io/libpb
- Attempt to mixin properly
This commit is contained in:
parent
b10c7d928d
commit
3d9b9a4976
|
@ -1,10 +1,11 @@
|
|||
module libpb.deserialization;
|
||||
|
||||
import std.json;
|
||||
import std.traits : FieldTypeTuple, FieldNameTuple;
|
||||
|
||||
template T(RecordType)
|
||||
|
||||
mixin template T(RecordType)
|
||||
{
|
||||
import std.traits : FieldTypeTuple, FieldNameTuple;
|
||||
public RecordType fromJSON(JSONValue jsonIn)
|
||||
{
|
||||
RecordType record;
|
||||
|
@ -131,7 +132,8 @@ unittest
|
|||
}
|
||||
`);
|
||||
|
||||
Person person = T!(Person).fromJSON(json);
|
||||
mixin T!(Person);
|
||||
Person person = fromJSON(json);
|
||||
|
||||
debug(dbg)
|
||||
{
|
||||
|
|
|
@ -158,7 +158,8 @@ public class PocketBase
|
|||
}
|
||||
}
|
||||
|
||||
recordsOut ~= T!(RecordType).fromJSON(returnedItem);
|
||||
mixin T!(RecordType);
|
||||
recordsOut ~= fromJSON(returnedItem);
|
||||
}
|
||||
|
||||
return recordsOut;
|
||||
|
@ -268,7 +269,8 @@ public class PocketBase
|
|||
responseJSON["passwordConfirm"] = "";
|
||||
}
|
||||
|
||||
recordOut = T!(RecordType).fromJSON(responseJSON);
|
||||
mixin T!(RecordType);
|
||||
recordOut = fromJSON(responseJSON);
|
||||
|
||||
return recordOut;
|
||||
}
|
||||
|
@ -349,7 +351,8 @@ public class PocketBase
|
|||
}
|
||||
|
||||
|
||||
recordOut = T!(RecordType).fromJSON(recordResponse);
|
||||
mixin T!(RecordType);
|
||||
recordOut = fromJSON(recordResponse);
|
||||
|
||||
// Store the token
|
||||
token = responseJSON["token"].str();
|
||||
|
@ -448,7 +451,8 @@ public class PocketBase
|
|||
}
|
||||
}
|
||||
|
||||
recordOut = T!(RecordType).fromJSON(responseJSON);
|
||||
mixin T!(RecordType);
|
||||
recordOut = fromJSON(responseJSON);
|
||||
|
||||
return recordOut;
|
||||
}
|
||||
|
@ -553,7 +557,8 @@ public class PocketBase
|
|||
}
|
||||
}
|
||||
|
||||
recordOut = T!(RecordType).fromJSON(responseJSON);
|
||||
mixin T!(RecordType);
|
||||
recordOut = fromJSON(responseJSON);
|
||||
|
||||
return recordOut;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue