This is meant to improve usability of Duration values and better integrate with the Go ecosystem.
This also makes the unit (micro/nanoseconds) difference between Duration and time.Duration more obvious, hopefully reducing the likelihood of introducing hard to detect bugs such as:
func ConvertDuration(d edgedb.Duration) time.Duration {
return time.Duration(int64(d))
// change from microseconds to nanoseconds representation is not taken care of,
// and the compiler can not help to prevent this
}
This is meant to improve usability of
Duration
values and better integrate with the Go ecosystem. This also makes the unit (micro/nanoseconds) difference betweenDuration
andtime.Duration
more obvious, hopefully reducing the likelihood of introducing hard to detect bugs such as: