ms-tester/pkg/utils/utils.go
Vyacheslav1557 d62ae666d5 refactor:
2024-10-09 23:55:16 +05:00

34 lines
471 B
Go

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)
}