Compare commits

...

2 Commits

Author SHA1 Message Date
Bobo
ef08927a50 feat: time trans 2025-04-02 15:18:08 +08:00
Bobo
6d209d3612 feat: time trans 2025-04-02 15:08:14 +08:00
3 changed files with 17 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ require (
github.com/go-kratos/kratos/v2 v2.8.4
github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.10.0
github.com/tx7do/go-utils v1.1.13
github.com/tx7do/go-utils v1.1.14
go.opentelemetry.io/otel v1.35.0
google.golang.org/protobuf v1.36.6
)

View File

@@ -1,4 +1,4 @@
git tag v1.1.14
git tag v1.1.15
git tag bank_card/v1.1.4
git tag geoip/v1.1.4

View File

@@ -165,3 +165,18 @@ func DurationpbToNumber[T int | int8 | int16 | int32 | int64 | uint | uint8 | ui
secondsWithPrecision := T(seconds / timePrecision.Seconds())
return &secondsWithPrecision
}
func DurationToDurationpb(duration *time.Duration) *durationpb.Duration {
if duration == nil {
return nil
}
return durationpb.New(*duration)
}
func DurationpbToDuration(duration *durationpb.Duration) *time.Duration {
if duration == nil {
return nil
}
d := duration.AsDuration()
return &d
}