[GODRIVER-774] Add mongo.NullTime type Created: 17/Jan/19 Updated: 25/Feb/19 Resolved: 25/Feb/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Masoud Ghorbani | Assignee: | Kristofer Brandow (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
language: Go |
||
| Description |
|
My interface has some timestamp fields which I think it would be better to consider default value of fields as null not 0001-01-01 00:00:00.000. It can be done by adding NullTime type to package. I think its general issue and loss of this typing may raise for many people and its possible handle it by adding custom typing. What do you think about adding mongo.NullTime type to package? |
| Comments |
| Comment by Kristofer Brandow (Inactive) [ 28/Jan/19 ] |
|
Hi jesuismasoud, Since 0001-01-01 00:00:00.000 is the zero time for time.Time this is what it'll marshal to. If you want to marshal to BSON Null instead, you'll need to register a codec for the time.Time type in a custom registry. --Kris |
| Comment by Masoud Ghorbani [ 17/Jan/19 ] |