Skip to content

Commit

Permalink
@Property added for some functions, Value.toString improved
Browse files Browse the repository at this point in the history
  • Loading branch information
denizzzka committed Mar 15, 2016
1 parent 2eca504 commit 92cd65e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dpq2/types/from_bson.d
Expand Up @@ -7,7 +7,7 @@ import vibe.data.bson;
import std.bitmanip: nativeToBigEndian;

/// Default type will be used for NULL value and for array without detected type
Value bsonToValue(Bson v, OidType defaultType = OidType.Unknown)
@property Value bsonToValue(Bson v, OidType defaultType = OidType.Unknown)
{
if(v.type == Bson.Type.array)
return bsonArrayToValue(v, defaultType);
Expand Down
4 changes: 2 additions & 2 deletions src/dpq2/types/from_d_types.d
Expand Up @@ -6,7 +6,7 @@ import dpq2;
import std.bitmanip: nativeToBigEndian;
import std.traits: isNumeric;

Value toValue(T)(T v)
@property Value toValue(T)(T v)
if(isNumeric!(T))
{
return Value(v.nativeToBigEndian.dup, detectOidType!T, false, ValueFormat.BINARY);
Expand All @@ -29,7 +29,7 @@ unittest
}
}

Value toValue(T)(T v, ValueFormat valueFormat = ValueFormat.BINARY) @trusted
@property Value toValue(T)(T v, ValueFormat valueFormat = ValueFormat.BINARY) @trusted
if(is(T == string))
{
if(valueFormat == ValueFormat.TEXT) v = v~'\0'; // for prepareArgs only
Expand Down
2 changes: 1 addition & 1 deletion src/dpq2/value.d
Expand Up @@ -50,7 +50,7 @@ struct Value
import dpq2.types.to_bson;
import std.conv: to;

return toBson(this).toString~"::"~oidType.to!string;
return toBson(this).toString~"::"~oidType.to!string~"("~(format == ValueFormat.TEXT? "t" : "b")~")";
}
}

Expand Down

0 comments on commit 92cd65e

Please sign in to comment.