optional

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthOptional        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowOptional          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupOptional = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Duration

type Duration struct {
	// ValuePlusOne is the logical value plus 1, so that zero remains the special
	// case of having no value.
	// DO NOT ACCESS THIS DIRECTLY. Use HasValue and Value instead.
	ValuePlusOne time.Duration `protobuf:"bytes,1,opt,name=value_plus_one,json=valuePlusOne,proto3,stdduration" json:"value_plus_one"`
}

Duration stores an optional time.Duration. Optional means that it may not be set, and one can differentiate between being unset and having a value of zero.

func MakeTimeValue

func MakeTimeValue(value time.Duration) Duration

MakeTimeValue returns an Duration with a set value.

func (*Duration) Add

func (d *Duration) Add(delta time.Duration)

Add modifies the value by adding a delta.

func (*Duration) Clear

func (d *Duration) Clear()

Clear the value.

func (*Duration) Descriptor

func (*Duration) Descriptor() ([]byte, []int)

func (Duration) HasValue

func (d Duration) HasValue() bool

HasValue returns true if a value was set.

func (*Duration) Marshal

func (m *Duration) Marshal() (dAtA []byte, err error)

func (*Duration) MarshalTo

func (m *Duration) MarshalTo(dAtA []byte) (int, error)

func (*Duration) MarshalToSizedBuffer

func (m *Duration) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Duration) MaybeAdd

func (d *Duration) MaybeAdd(other Duration)

MaybeAdd adds the given value, if it is set. Does nothing if other is not set.

func (*Duration) ProtoMessage

func (*Duration) ProtoMessage()

func (*Duration) Reset

func (m *Duration) Reset()

func (*Duration) Set

func (d *Duration) Set(value time.Duration)

Set the value.

func (*Duration) Size

func (m *Duration) Size() (n int)

func (Duration) String

func (d Duration) String() string

func (*Duration) Unmarshal

func (m *Duration) Unmarshal(dAtA []byte) error

func (Duration) Value

func (d Duration) Value() time.Duration

Value returns the current value, or 0 if HasValue() is false.

func (*Duration) XXX_DiscardUnknown

func (m *Duration) XXX_DiscardUnknown()

func (*Duration) XXX_Marshal

func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Duration) XXX_Merge

func (m *Duration) XXX_Merge(src proto.Message)

func (*Duration) XXX_Size

func (m *Duration) XXX_Size() int

func (*Duration) XXX_Unmarshal

func (m *Duration) XXX_Unmarshal(b []byte) error

type Uint

type Uint struct {
	// The underlying value is the logical value plus 1, so that zero remains the
	// special case of having no value.
	ValuePlusOne uint64 `protobuf:"varint,1,opt,name=value_plus_one,json=valuePlusOne,proto3" json:"value_plus_one,omitempty"`
}

Uint stores an optional unsigned integer value. Optional means that it may not be set, and one can differentiate between being unset and having a value of zero.

func MakeUint

func MakeUint(value uint64) Uint

MakeUint returns an Uint with a set value. The maximum value that can be represented is (MaxUint64-1).

func (*Uint) Add

func (i *Uint) Add(delta int64)

Add modifies the value by adding a delta.

func (*Uint) Clear

func (i *Uint) Clear()

Clear the value.

func (*Uint) Descriptor

func (*Uint) Descriptor() ([]byte, []int)

func (Uint) HasValue

func (i Uint) HasValue() bool

HasValue returns true if a value was set.

func (*Uint) Marshal

func (m *Uint) Marshal() (dAtA []byte, err error)

func (*Uint) MarshalTo

func (m *Uint) MarshalTo(dAtA []byte) (int, error)

func (*Uint) MarshalToSizedBuffer

func (m *Uint) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Uint) MaybeAdd

func (i *Uint) MaybeAdd(other Uint)

MaybeAdd adds the given value, if it is set. Does nothing if other is not set.

func (*Uint) ProtoMessage

func (*Uint) ProtoMessage()

func (*Uint) Reset

func (m *Uint) Reset()

func (*Uint) Set

func (i *Uint) Set(value uint64)

Set the value.

func (*Uint) Size

func (m *Uint) Size() (n int)

func (Uint) String

func (i Uint) String() string

String returns the value or "<unset>".

func (*Uint) Unmarshal

func (m *Uint) Unmarshal(dAtA []byte) error

func (Uint) Value

func (i Uint) Value() uint64

Value returns the current value, or 0 if HasValue() is false.

func (*Uint) XXX_DiscardUnknown

func (m *Uint) XXX_DiscardUnknown()

func (*Uint) XXX_Marshal

func (m *Uint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Uint) XXX_Merge

func (m *Uint) XXX_Merge(src proto.Message)

func (*Uint) XXX_Size

func (m *Uint) XXX_Size() int

func (*Uint) XXX_Unmarshal

func (m *Uint) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL