amazon-ion / ion-go

A Go implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
173 stars 31 forks source link

Unmarshal to native Time #174

Closed icrustandi closed 3 years ago

icrustandi commented 3 years ago

Hi, I just noticed that support for native go Time was most recently added to marshal. I was wondering if the same support could be added for the unmarshal as well. I looked at unmarshal.go and it seems like only ion.Timestamp is supported. https://github.com/amzn/ion-go/blob/master/ion/unmarshal.go#L86

Currently the following happens:

        val, _ := ion.MarshalText(time.Now())
        result := new(time.Time)
        err = ion.Unmarshal(val, result) 
        // ion: cannot decode 0001-01-01 00:00:00 +0000 UTC into time.Time
justing-bq commented 3 years ago

This issue has been addressed and included in release v1.1.3.