ibm-messaging / mq-golang

Calling IBM MQ from Go applications
Apache License 2.0
168 stars 60 forks source link

Add Time() method to MQMD type #159

Closed ravellan closed 3 years ago

ravellan commented 3 years ago

Please ensure all items are complete before opening.

What

Add a Time method to MQMD that returns the put date/time as a native Go Time type This is perhaps out of scope for this package and better suited for other packages which is fine.

How

PutDate and PutTime from the MD is parsed in the Time package to return a time.Time type An error is returned if the MD is empty.

Testing

Test is added in package test suite.

Issues

N/A

ibmmqmet commented 3 years ago

Thanks for this idea. I don't think I want to accept the PR as-is, because there's actually a more general aspect to solve - the PutDate & Time fields can be set as well as read, and is also in the MQDLH structure.

So I think I'd like to take the concept here but do it slightly differently and cover all the options. Probably I'll add a single PutDateTime field into the structures as you can then choose in your app which to work with (can't delete the existing strings for compatibility).