ms-tester/pkg/utils/utils.go

34 lines
471 B
Go
Raw Permalink Normal View History

2024-10-09 18:55:16 +00:00
package utils
import (
"google.golang.org/protobuf/types/known/timestamppb"
"time"
)
func AsTimeP(t time.Time) *time.Time {
return &t
}
func AsInt32P(v int32) *int32 {
return &v
}
func AsStringP(str string) *string {
return &str
}
func TimeP(t *timestamppb.Timestamp) *time.Time {
if t == nil {
return nil
}
tt := t.AsTime()
return &tt
}
func TimestampP(t *time.Time) *timestamppb.Timestamp {
if t == nil {
return nil
}
return timestamppb.New(*t)
}