diff --git a/orm/encoding/ormfield/duration.go b/orm/encoding/ormfield/duration.go index 6b4b42fabe73..078d0ca61477 100644 --- a/orm/encoding/ormfield/duration.go +++ b/orm/encoding/ormfield/duration.go @@ -8,10 +8,10 @@ import ( ) const ( - DurationSecondsMin = -315576000000 - DurationSecondsMax = 315576000000 - DurationNanosMin = -999999999 - DurationNanosMax = 999999999 + DurationSecondsMin int64 = -315576000000 + DurationSecondsMax int64 = 315576000000 + DurationNanosMin = -999999999 + DurationNanosMax = 999999999 ) // DurationCodec encodes google.protobuf.Duration values with the following @@ -41,7 +41,7 @@ func (d DurationCodec) Encode(value protoreflect.Value, w io.Writer) error { return fmt.Errorf("duration seconds is out of range %d, must be between %d and %d", secondsInt, DurationSecondsMin, DurationSecondsMax) } negative := secondsInt < 0 - // we subtract the min duration value to make sure secondsInt is always non-negative and starts at 0 + // we subtract the min duration value to make sure secondsInt is always non-negative and starts at 0. secondsInt -= DurationSecondsMin err := encodeSeconds(secondsInt, w) if err != nil { diff --git a/orm/encoding/ormfield/timestamp.go b/orm/encoding/ormfield/timestamp.go index ab3c5049cb36..0049b13f156a 100644 --- a/orm/encoding/ormfield/timestamp.go +++ b/orm/encoding/ormfield/timestamp.go @@ -21,12 +21,12 @@ import ( type TimestampCodec struct{} const ( - timestampDurationNilValue = 0xFF - timestampDurationZeroNanosValue = 0x0 - timestampDurationBufferSize = 9 - TimestampSecondsMin = -62135596800 - TimestampSecondsMax = 253402300799 - TimestampNanosMax = 999999999 + timestampDurationNilValue = 0xFF + timestampDurationZeroNanosValue = 0x0 + timestampDurationBufferSize = 9 + TimestampSecondsMin int64 = -62135596800 + TimestampSecondsMax int64 = 253402300799 + TimestampNanosMax = 999999999 ) var (