Skip to content

Commit

Permalink
Merge pull request #107 from tchaloupka/uuid
Browse files Browse the repository at this point in the history
[trivial] Add support for Nullable!UUID
  • Loading branch information
denizzzka authored May 7, 2018
2 parents d2b60b1 + f10f8f0 commit b3baad1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dpq2/conv/native_tests.d
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void _integration_test( string connParam ) @system
C!PGbytea([0x44, 0x20, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x00, 0x21],
"bytea", r"E'\\x44 20 72 75 6c 65 73 00 21'"); // "D rules\x00!" (ASCII)
C!PGuuid(UUID("8b9ab33a-96e9-499b-9c36-aad1fe86d640"), "uuid", "'8b9ab33a-96e9-499b-9c36-aad1fe86d640'");
C!(Nullable!PGuuid)(Nullable!UUID(UUID("8b9ab33a-96e9-499b-9c36-aad1fe86d640")), "uuid", "'8b9ab33a-96e9-499b-9c36-aad1fe86d640'");

// numeric testing
C!PGnumeric("NaN", "numeric", "'NaN'");
Expand Down
2 changes: 2 additions & 0 deletions src/dpq2/oids.d
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ private OidType detectOidTypeNotCareAboutNullable(T)()
import std.datetime.date : StdDate = Date, TimeOfDay;
import std.datetime.systime : SysTime;
import std.traits : Unqual;
import std.uuid : StdUUID = UUID;
static import dpq2.conv.time;
import vibe.data.json : VibeJson = Json;

Expand All @@ -189,6 +190,7 @@ private OidType detectOidTypeNotCareAboutNullable(T)()
static if(is(UT == dpq2.conv.time.TimeStamp)){ return TimeStamp; } else
static if(is(UT == dpq2.conv.time.TimeStampUTC)){ return TimeStampWithZone; } else
static if(is(UT == VibeJson)){ return Json; } else
static if(is(UT == StdUUID)){ return UUID; } else

static assert(false, "Unsupported D type: "~T.stringof);
}
Expand Down

0 comments on commit b3baad1

Please sign in to comment.