Skip to content

Commit

Permalink
Use prepare/transfer to allow Json.buildQuery() to work at compile time.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmonday committed Apr 20, 2012
1 parent 8bdfb3c commit d35e8d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions serenity/persister/backend/Json.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import serenity.core.Config;

import serenity.persister.Query;

import serenity.util.Transfer;

import std.file;
import std.json;
import std.path;
Expand Down Expand Up @@ -55,7 +57,7 @@ final class Json

static buildQuery(T)(Query!T query)
{
return query;
return prepare(query);
}

// TODO This is duplicated all over the place and should be factored out
Expand All @@ -64,8 +66,9 @@ final class Json
enum fieldName = T.tupleof[i].stringof[T.stringof.length + 3 .. $];
}

T[] execute(T, Params...)(Query!T query, Params params)
T[] execute(T, Params...)(typeof(prepare(new Query!T)) _query, Params params)
{
immutable query = transfer!(Query!T)(_query);
immutable file = directory ~ dirSeparator ~ T.stringof ~ ".json";
final switch(query.type)
{
Expand Down

0 comments on commit d35e8d2

Please sign in to comment.