diff --git a/pkg/proto/wrapperspb/wrapperspb.go b/pkg/proto/wrapperspb/wrapperspb.go index 0ed5a0ef2..229d07ede 100644 --- a/pkg/proto/wrapperspb/wrapperspb.go +++ b/pkg/proto/wrapperspb/wrapperspb.go @@ -42,6 +42,69 @@ func Bytes(value []byte) *BytesValue { return &BytesValue{Value: value} } +func DoublePtr(value *float64) *DoubleValue { + if value == nil { + return nil + } + return &DoubleValue{Value: *value} +} + +func FloatPtr(value *float32) *FloatValue { + if value == nil { + return nil + } + return &FloatValue{Value: *value} +} + +func Int64Ptr(value *int64) *Int64Value { + if value == nil { + return nil + } + return &Int64Value{Value: *value} +} + +func UInt64Ptr(value *uint64) *UInt64Value { + if value == nil { + return nil + } + return &UInt64Value{Value: *value} +} + +func Int32Ptr(value *int32) *Int32Value { + if value == nil { + return nil + } + return &Int32Value{Value: *value} +} + +func UInt32Ptr(value *uint32) *UInt32Value { + if value == nil { + return nil + } + return &UInt32Value{Value: *value} +} + +func BoolPtr(value *bool) *BoolValue { + if value == nil { + return nil + } + return &BoolValue{Value: *value} +} + +func StringPtr(value *string) *StringValue { + if value == nil { + return nil + } + return &StringValue{Value: *value} +} + +func BytesPtr(value *[]byte) *BytesValue { + if value == nil { + return nil + } + return &BytesValue{Value: *value} +} + func (m *DoubleValue) UnmarshalJSON(p []byte) error { value, err := strconv.ParseFloat(string(p), 64) if err != nil { @@ -160,3 +223,66 @@ func (m *BytesValue) UnmarshalJSON(p []byte) error { func (m *BytesValue) MarshalJSON() ([]byte, error) { return []byte(`"` + base64.StdEncoding.EncodeToString(m.Value) + `"`), nil } + +func (m *DoubleValue) GetValuePtr() *float64 { + if m == nil { + return nil + } + return &m.Value +} + +func (m *FloatValue) GetValuePtr() *float32 { + if m == nil { + return nil + } + return &m.Value +} + +func (m *Int64Value) GetValuePtr() *int64 { + if m == nil { + return nil + } + return &m.Value +} + +func (m *UInt64Value) GetValuePtr() *uint64 { + if m == nil { + return nil + } + return &m.Value +} + +func (m *Int32Value) GetValuePtr() *int32 { + if m == nil { + return nil + } + return &m.Value +} + +func (m *UInt32Value) GetValuePtr() *uint32 { + if m == nil { + return nil + } + return &m.Value +} + +func (m *BoolValue) GetValuePtr() *bool { + if m == nil { + return nil + } + return &m.Value +} + +func (m *StringValue) GetValuePtr() *string { + if m == nil { + return nil + } + return &m.Value +} + +func (m *BytesValue) GetValuePtr() *[]byte { + if m == nil { + return nil + } + return &m.Value +}