Skip to content

Commit 4f980fa

Browse files
committed
Now supports the time type
1 parent d34ce02 commit 4f980fa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

json-to-go.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ function jsonToGo(json, typename)
119119
switch (typeof val)
120120
{
121121
case "string":
122-
return "string";
122+
if (/\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\+\d\d:\d\d/.test(val))
123+
return "time.Time";
124+
else
125+
return "string";
123126
case "number":
124127
if (val % 1 === 0)
125128
{

0 commit comments

Comments
 (0)