We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time.Duration
The current structs have TimeStamp set to be an int when it is probably better served to be a time.Duration object.
TimeStamp
int
We will likely need to update the UnmarshalJSON of some of these to get everything to work correctly. Something like the following:
UnmarshalJSON
type HarvestInfo struct { TimeStamp timedur Difficulty int64 TotalFee int64 ID int64 Height int64 } type timedur struct { time.Duration } func (td *timedur) UnmarshalJSON(b []bytes) error { timestamp, err := strconv.ParseFloat(string(b), 0) if err != nil { return err } td.Duration = time.Duration(timestamp) * time.Second return nil }
Not sure this is the best approach, but it is tested in playground and works https://play.golang.org/p/Voi-DFkZ-qh
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The current structs have
TimeStamp
set to be anint
when it is probably better served to be atime.Duration
object.We will likely need to update the
UnmarshalJSON
of some of these to get everything to work correctly. Something like the following:Not sure this is the best approach, but it is tested in playground and works
https://play.golang.org/p/Voi-DFkZ-qh
The text was updated successfully, but these errors were encountered: