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;
|
module libpb.deserialization;
|
||||||
|
|
||||||
import std.json;
|
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)
|
public RecordType fromJSON(JSONValue jsonIn)
|
||||||
{
|
{
|
||||||
RecordType record;
|
RecordType record;
|
||||||
|
@ -131,7 +132,8 @@ unittest
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
Person person = T!(Person).fromJSON(json);
|
mixin T!(Person);
|
||||||
|
Person person = fromJSON(json);
|
||||||
|
|
||||||
debug(dbg)
|
debug(dbg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,7 +158,8 @@ public class PocketBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recordsOut ~= T!(RecordType).fromJSON(returnedItem);
|
mixin T!(RecordType);
|
||||||
|
recordsOut ~= fromJSON(returnedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return recordsOut;
|
return recordsOut;
|
||||||
|
@ -268,7 +269,8 @@ public class PocketBase
|
||||||
responseJSON["passwordConfirm"] = "";
|
responseJSON["passwordConfirm"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
recordOut = T!(RecordType).fromJSON(responseJSON);
|
mixin T!(RecordType);
|
||||||
|
recordOut = fromJSON(responseJSON);
|
||||||
|
|
||||||
return recordOut;
|
return recordOut;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +351,8 @@ public class PocketBase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
recordOut = T!(RecordType).fromJSON(recordResponse);
|
mixin T!(RecordType);
|
||||||
|
recordOut = fromJSON(recordResponse);
|
||||||
|
|
||||||
// Store the token
|
// Store the token
|
||||||
token = responseJSON["token"].str();
|
token = responseJSON["token"].str();
|
||||||
|
@ -448,7 +451,8 @@ public class PocketBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recordOut = T!(RecordType).fromJSON(responseJSON);
|
mixin T!(RecordType);
|
||||||
|
recordOut = fromJSON(responseJSON);
|
||||||
|
|
||||||
return recordOut;
|
return recordOut;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +557,8 @@ public class PocketBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recordOut = T!(RecordType).fromJSON(responseJSON);
|
mixin T!(RecordType);
|
||||||
|
recordOut = fromJSON(responseJSON);
|
||||||
|
|
||||||
return recordOut;
|
return recordOut;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue