Package types
Overview ▹
Index ▹
Variables
var ( ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthStruct = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowStruct = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") )
var NullValue_name = map[int32]string{ 0: "NULL_VALUE", }
var NullValue_value = map[string]int32{ "NULL_VALUE": 0, }
func AnyMessageName ¶
func AnyMessageName(any *Any) (string, error)
AnyMessageName returns the name of the message contained in a google.protobuf.Any message.
Note that regular type assertions should be done using the Is function. AnyMessageName is provided for less common use cases like filtering a sequence of Any messages based on a set of allowed message type names.
func DurationFromProto ¶
func DurationFromProto(p *Duration) (time.Duration, error)
DurationFromProto converts a Duration to a time.Duration. DurationFromProto returns an error if the Duration is invalid or is too large to be represented in a time.Duration.
func EmptyAny ¶
func EmptyAny(any *Any) (proto.Message, error)
Empty returns a new proto.Message of the type specified in a google.protobuf.Any message. It returns an error if corresponding message type isn't linked in.
func Is ¶
func Is(any *Any, pb proto.Message) bool
Is returns true if any value contains a given message type.
func NewPopulatedStdDuration ¶
func NewPopulatedStdDuration(r interface { Int63() int64 }, easy bool) *time.Duration
func NewPopulatedStdTime ¶
func NewPopulatedStdTime(r interface { Int63() int64 }, easy bool) *time.Time
func SizeOfStdDuration ¶
func SizeOfStdDuration(d time.Duration) int
func SizeOfStdTime ¶
func SizeOfStdTime(t time.Time) int
func StdDurationMarshal ¶
func StdDurationMarshal(d time.Duration) ([]byte, error)
func StdDurationMarshalTo ¶
func StdDurationMarshalTo(d time.Duration, data []byte) (int, error)
func StdDurationUnmarshal ¶
func StdDurationUnmarshal(d *time.Duration, data []byte) error
func StdTimeMarshal ¶
func StdTimeMarshal(t time.Time) ([]byte, error)
func StdTimeMarshalTo ¶
func StdTimeMarshalTo(t time.Time, data []byte) (int, error)
func StdTimeUnmarshal ¶
func StdTimeUnmarshal(t *time.Time, data []byte) error
func TimestampFromProto ¶
func TimestampFromProto(ts *Timestamp) (time.Time, error)
TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. It returns an error if the argument is invalid.
Unlike most Go functions, if Timestamp returns an error, the first return value is not the zero time.Time. Instead, it is the value obtained from the time.Unix function when passed the contents of the Timestamp, in the UTC locale. This may or may not be a meaningful time; many invalid Timestamps do map to valid time.Times.
A nil Timestamp returns an error. The first return value in that case is undefined.
func TimestampString ¶
func TimestampString(ts *Timestamp) string
TimestampString returns the RFC 3339 string for valid Timestamps. For invalid Timestamps, it returns an error message in parentheses.
func UnmarshalAny ¶
func UnmarshalAny(any *Any, pb proto.Message) error
UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any message and places the decoded result in pb. It returns an error if type of contents of Any message does not match type of pb message.
pb can be a proto.Message, or a *DynamicAny.
type Any ¶
`Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.
Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type.
Example 1: Pack and unpack a message in C++.
Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... }
Example 2: Pack and unpack a message in Java.
Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ...
The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z".
JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example:
package google.profile; message Person { string first_name = 1; string last_name = 2; } { "@type": "type.googleapis.com/google.profile.Person", "firstName": <string>, "lastName": <string> }
If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]):
{ "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" }
type Any struct { // A URL/resource name whose content describes the type of the // serialized protocol buffer message. // // For URLs which use the scheme `http`, `https`, or no scheme, the // following restrictions and interpretations apply: // // * If no scheme is provided, `https` is assumed. // * The last segment of the URL's path must represent the fully // qualified name of the type (as in `path/google.protobuf.Duration`). // The name should be in a canonical form (e.g., leading "." is // not accepted). // * An HTTP GET on the URL must yield a [google.protobuf.Type][] // value in binary format, or produce an error. // * Applications are allowed to cache lookup results based on the // URL, or have them precompiled into a binary to avoid any // lookup. Therefore, binary compatibility needs to be preserved // on changes to types. (Use versioned type names to manage // breaking changes.) // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. // TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` // Must be a valid serialized protocol buffer of the above specified type. Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
func MarshalAny ¶
func MarshalAny(pb proto.Message) (*Any, error)
MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any.
func NewPopulatedAny ¶
func NewPopulatedAny(r randyAny, easy bool) *Any
func (*Any) Compare ¶
func (this *Any) Compare(that interface{}) int
func (*Any) Descriptor ¶
func (*Any) Descriptor() ([]byte, []int)
func (*Any) Equal ¶
func (this *Any) Equal(that interface{}) bool
func (*Any) GetTypeUrl ¶
func (m *Any) GetTypeUrl() string
func (*Any) GetValue ¶
func (m *Any) GetValue() []byte
func (*Any) GoString ¶
func (this *Any) GoString() string
func (*Any) Marshal ¶
func (m *Any) Marshal() (dAtA []byte, err error)
func (*Any) MarshalTo ¶
func (m *Any) MarshalTo(dAtA []byte) (int, error)
func (*Any) ProtoMessage ¶
func (*Any) ProtoMessage()
func (*Any) Reset ¶
func (m *Any) Reset()
func (*Any) Size ¶
func (m *Any) Size() (n int)
func (*Any) String ¶
func (this *Any) String() string
func (*Any) Unmarshal ¶
func (m *Any) Unmarshal(dAtA []byte) error
func (*Any) XXX_WellKnownType ¶
func (*Any) XXX_WellKnownType() string
type BoolValue ¶
Wrapper message for `bool`.
The JSON representation for `BoolValue` is JSON `true` and `false`.
type BoolValue struct {
// The bool value.
Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedBoolValue ¶
func NewPopulatedBoolValue(r randyWrappers, easy bool) *BoolValue
func (*BoolValue) Compare ¶
func (this *BoolValue) Compare(that interface{}) int
func (*BoolValue) Descriptor ¶
func (*BoolValue) Descriptor() ([]byte, []int)
func (*BoolValue) Equal ¶
func (this *BoolValue) Equal(that interface{}) bool
func (*BoolValue) GetValue ¶
func (m *BoolValue) GetValue() bool
func (*BoolValue) GoString ¶
func (this *BoolValue) GoString() string
func (*BoolValue) Marshal ¶
func (m *BoolValue) Marshal() (dAtA []byte, err error)
func (*BoolValue) MarshalTo ¶
func (m *BoolValue) MarshalTo(dAtA []byte) (int, error)
func (*BoolValue) ProtoMessage ¶
func (*BoolValue) ProtoMessage()
func (*BoolValue) Reset ¶
func (m *BoolValue) Reset()
func (*BoolValue) Size ¶
func (m *BoolValue) Size() (n int)
func (*BoolValue) String ¶
func (this *BoolValue) String() string
func (*BoolValue) Unmarshal ¶
func (m *BoolValue) Unmarshal(dAtA []byte) error
func (*BoolValue) XXX_WellKnownType ¶
func (*BoolValue) XXX_WellKnownType() string
type BytesValue ¶
Wrapper message for `bytes`.
The JSON representation for `BytesValue` is JSON string.
type BytesValue struct {
// The bytes value.
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedBytesValue ¶
func NewPopulatedBytesValue(r randyWrappers, easy bool) *BytesValue
func (*BytesValue) Compare ¶
func (this *BytesValue) Compare(that interface{}) int
func (*BytesValue) Descriptor ¶
func (*BytesValue) Descriptor() ([]byte, []int)
func (*BytesValue) Equal ¶
func (this *BytesValue) Equal(that interface{}) bool
func (*BytesValue) GetValue ¶
func (m *BytesValue) GetValue() []byte
func (*BytesValue) GoString ¶
func (this *BytesValue) GoString() string
func (*BytesValue) Marshal ¶
func (m *BytesValue) Marshal() (dAtA []byte, err error)
func (*BytesValue) MarshalTo ¶
func (m *BytesValue) MarshalTo(dAtA []byte) (int, error)
func (*BytesValue) ProtoMessage ¶
func (*BytesValue) ProtoMessage()
func (*BytesValue) Reset ¶
func (m *BytesValue) Reset()
func (*BytesValue) Size ¶
func (m *BytesValue) Size() (n int)
func (*BytesValue) String ¶
func (this *BytesValue) String() string
func (*BytesValue) Unmarshal ¶
func (m *BytesValue) Unmarshal(dAtA []byte) error
func (*BytesValue) XXX_WellKnownType ¶
func (*BytesValue) XXX_WellKnownType() string
type DoubleValue ¶
Wrapper message for `double`.
The JSON representation for `DoubleValue` is JSON number.
type DoubleValue struct {
// The double value.
Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedDoubleValue ¶
func NewPopulatedDoubleValue(r randyWrappers, easy bool) *DoubleValue
func (*DoubleValue) Compare ¶
func (this *DoubleValue) Compare(that interface{}) int
func (*DoubleValue) Descriptor ¶
func (*DoubleValue) Descriptor() ([]byte, []int)
func (*DoubleValue) Equal ¶
func (this *DoubleValue) Equal(that interface{}) bool
func (*DoubleValue) GetValue ¶
func (m *DoubleValue) GetValue() float64
func (*DoubleValue) GoString ¶
func (this *DoubleValue) GoString() string
func (*DoubleValue) Marshal ¶
func (m *DoubleValue) Marshal() (dAtA []byte, err error)
func (*DoubleValue) MarshalTo ¶
func (m *DoubleValue) MarshalTo(dAtA []byte) (int, error)
func (*DoubleValue) ProtoMessage ¶
func (*DoubleValue) ProtoMessage()
func (*DoubleValue) Reset ¶
func (m *DoubleValue) Reset()
func (*DoubleValue) Size ¶
func (m *DoubleValue) Size() (n int)
func (*DoubleValue) String ¶
func (this *DoubleValue) String() string
func (*DoubleValue) Unmarshal ¶
func (m *DoubleValue) Unmarshal(dAtA []byte) error
func (*DoubleValue) XXX_WellKnownType ¶
func (*DoubleValue) XXX_WellKnownType() string
type Duration ¶
A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp. Range is approximately +-10,000 years.
Example 1: Compute Duration from two Timestamps in pseudo code.
Timestamp start = ...; Timestamp end = ...; Duration duration = ...; duration.seconds = end.seconds - start.seconds; duration.nanos = end.nanos - start.nanos; if (duration.seconds < 0 && duration.nanos > 0) { duration.seconds += 1; duration.nanos -= 1000000000; } else if (durations.seconds > 0 && duration.nanos < 0) { duration.seconds -= 1; duration.nanos += 1000000000; }
Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
Timestamp start = ...; Duration duration = ...; Timestamp end = ...; end.seconds = start.seconds + duration.seconds; end.nanos = start.nanos + duration.nanos; if (end.nanos < 0) { end.seconds -= 1; end.nanos += 1000000000; } else if (end.nanos >= 1000000000) { end.seconds += 1; end.nanos -= 1000000000; }
type Duration struct { // Signed seconds of the span of time. Must be from -315,576,000,000 // to +315,576,000,000 inclusive. Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` // Signed fractions of a second at nanosecond resolution of the span // of time. Durations less than one second are represented with a 0 // `seconds` field and a positive or negative `nanos` field. For durations // of one second or more, a non-zero value for the `nanos` field must be // of the same sign as the `seconds` field. Must be from -999,999,999 // to +999,999,999 inclusive. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` }
func DurationProto ¶
func DurationProto(d time.Duration) *Duration
DurationProto converts a time.Duration to a Duration.
func NewPopulatedDuration ¶
func NewPopulatedDuration(r interface { Int63() int64 }, easy bool) *Duration
func (*Duration) Compare ¶
func (this *Duration) Compare(that interface{}) int
func (*Duration) Descriptor ¶
func (*Duration) Descriptor() ([]byte, []int)
func (*Duration) Equal ¶
func (this *Duration) Equal(that interface{}) bool
func (*Duration) GetNanos ¶
func (m *Duration) GetNanos() int32
func (*Duration) GetSeconds ¶
func (m *Duration) GetSeconds() int64
func (*Duration) GoString ¶
func (this *Duration) GoString() string
func (*Duration) Marshal ¶
func (m *Duration) Marshal() (dAtA []byte, err error)
func (*Duration) MarshalTo ¶
func (m *Duration) MarshalTo(dAtA []byte) (int, error)
func (*Duration) ProtoMessage ¶
func (*Duration) ProtoMessage()
func (*Duration) Reset ¶
func (m *Duration) Reset()
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) XXX_WellKnownType ¶
func (*Duration) XXX_WellKnownType() string
type DynamicAny ¶
DynamicAny is a value that can be passed to UnmarshalAny to automatically allocate a proto.Message for the type specified in a google.protobuf.Any message. The allocated message is stored in the embedded proto.Message.
Example:
var x ptypes.DynamicAny if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } fmt.Printf("unmarshaled message: %v", x.Message)
type DynamicAny struct { proto.Message }
type Empty ¶
A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:
service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
The JSON representation for `Empty` is empty JSON object `{}`.
type Empty struct { }
func NewPopulatedEmpty ¶
func NewPopulatedEmpty(r randyEmpty, easy bool) *Empty
func (*Empty) Compare ¶
func (this *Empty) Compare(that interface{}) int
func (*Empty) Descriptor ¶
func (*Empty) Descriptor() ([]byte, []int)
func (*Empty) Equal ¶
func (this *Empty) Equal(that interface{}) bool
func (*Empty) GoString ¶
func (this *Empty) GoString() string
func (*Empty) Marshal ¶
func (m *Empty) Marshal() (dAtA []byte, err error)
func (*Empty) MarshalTo ¶
func (m *Empty) MarshalTo(dAtA []byte) (int, error)
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) Reset ¶
func (m *Empty) Reset()
func (*Empty) Size ¶
func (m *Empty) Size() (n int)
func (*Empty) String ¶
func (this *Empty) String() string
func (*Empty) Unmarshal ¶
func (m *Empty) Unmarshal(dAtA []byte) error
func (*Empty) XXX_WellKnownType ¶
func (*Empty) XXX_WellKnownType() string
type FieldMask ¶
`FieldMask` represents a set of symbolic field paths, for example:
paths: "f.a" paths: "f.b.d"
Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`.
Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below).
# Field Masks in Projections
When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows:
f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8
The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output):
f { a : 22 b { d : 1 } }
A repeated field is not allowed except at the last position of a field mask.
If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified).
Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs.
# Field Masks in Update Operations
A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask.
If a repeated field is specified for an update operation, the existing repeated values in the target resource will be overwritten by the new values. Note that a repeated field is only allowed in the last position of a field mask.
If a sub-message is specified in the last position of the field mask for an update operation, then the existing sub-message in the target resource is overwritten. Given the target message:
f { b { d : 1 x : 2 } c : 1 }
And an update message:
f { b { d : 10 } }
then if the field mask is:
paths: "f.b"
then the result will be:
f { b { d : 10 } c : 1 }
However, if the update mask was:
paths: "f.b.d"
then the result would be:
f { b { d : 10 x : 2 } c : 1 }
In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below.
If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not.
As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API.
## Considerations for HTTP REST
The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates).
# JSON Encoding of Field Masks
In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions.
As an example, consider the following message declarations:
message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; }
In proto a field mask for `Profile` may look as such:
mask { paths: "user.display_name" paths: "photo" }
In JSON, the same mask is represented as below:
{ mask: "user.displayName,photo" }
# Field Masks and Oneof Fields
Field masks treat fields in oneofs just as regular fields. Consider the following message:
message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } }
The field mask can be:
mask { paths: "name" }
Or:
mask { paths: "sub_message" }
Note that oneof type names ("test_oneof" in this case) cannot be used in paths.
type FieldMask struct {
// The set of field mask paths.
Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"`
}
func NewPopulatedFieldMask ¶
func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask
func (*FieldMask) Compare ¶
func (this *FieldMask) Compare(that interface{}) int
func (*FieldMask) Descriptor ¶
func (*FieldMask) Descriptor() ([]byte, []int)
func (*FieldMask) Equal ¶
func (this *FieldMask) Equal(that interface{}) bool
func (*FieldMask) GetPaths ¶
func (m *FieldMask) GetPaths() []string
func (*FieldMask) GoString ¶
func (this *FieldMask) GoString() string
func (*FieldMask) Marshal ¶
func (m *FieldMask) Marshal() (dAtA []byte, err error)
func (*FieldMask) MarshalTo ¶
func (m *FieldMask) MarshalTo(dAtA []byte) (int, error)
func (*FieldMask) ProtoMessage ¶
func (*FieldMask) ProtoMessage()
func (*FieldMask) Reset ¶
func (m *FieldMask) Reset()
func (*FieldMask) Size ¶
func (m *FieldMask) Size() (n int)
func (*FieldMask) String ¶
func (this *FieldMask) String() string
func (*FieldMask) Unmarshal ¶
func (m *FieldMask) Unmarshal(dAtA []byte) error
type FloatValue ¶
Wrapper message for `float`.
The JSON representation for `FloatValue` is JSON number.
type FloatValue struct {
// The float value.
Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedFloatValue ¶
func NewPopulatedFloatValue(r randyWrappers, easy bool) *FloatValue
func (*FloatValue) Compare ¶
func (this *FloatValue) Compare(that interface{}) int
func (*FloatValue) Descriptor ¶
func (*FloatValue) Descriptor() ([]byte, []int)
func (*FloatValue) Equal ¶
func (this *FloatValue) Equal(that interface{}) bool
func (*FloatValue) GetValue ¶
func (m *FloatValue) GetValue() float32
func (*FloatValue) GoString ¶
func (this *FloatValue) GoString() string
func (*FloatValue) Marshal ¶
func (m *FloatValue) Marshal() (dAtA []byte, err error)
func (*FloatValue) MarshalTo ¶
func (m *FloatValue) MarshalTo(dAtA []byte) (int, error)
func (*FloatValue) ProtoMessage ¶
func (*FloatValue) ProtoMessage()
func (*FloatValue) Reset ¶
func (m *FloatValue) Reset()
func (*FloatValue) Size ¶
func (m *FloatValue) Size() (n int)
func (*FloatValue) String ¶
func (this *FloatValue) String() string
func (*FloatValue) Unmarshal ¶
func (m *FloatValue) Unmarshal(dAtA []byte) error
func (*FloatValue) XXX_WellKnownType ¶
func (*FloatValue) XXX_WellKnownType() string
type Int32Value ¶
Wrapper message for `int32`.
The JSON representation for `Int32Value` is JSON number.
type Int32Value struct {
// The int32 value.
Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedInt32Value ¶
func NewPopulatedInt32Value(r randyWrappers, easy bool) *Int32Value
func (*Int32Value) Compare ¶
func (this *Int32Value) Compare(that interface{}) int
func (*Int32Value) Descriptor ¶
func (*Int32Value) Descriptor() ([]byte, []int)
func (*Int32Value) Equal ¶
func (this *Int32Value) Equal(that interface{}) bool
func (*Int32Value) GetValue ¶
func (m *Int32Value) GetValue() int32
func (*Int32Value) GoString ¶
func (this *Int32Value) GoString() string
func (*Int32Value) Marshal ¶
func (m *Int32Value) Marshal() (dAtA []byte, err error)
func (*Int32Value) MarshalTo ¶
func (m *Int32Value) MarshalTo(dAtA []byte) (int, error)
func (*Int32Value) ProtoMessage ¶
func (*Int32Value) ProtoMessage()
func (*Int32Value) Reset ¶
func (m *Int32Value) Reset()
func (*Int32Value) Size ¶
func (m *Int32Value) Size() (n int)
func (*Int32Value) String ¶
func (this *Int32Value) String() string
func (*Int32Value) Unmarshal ¶
func (m *Int32Value) Unmarshal(dAtA []byte) error
func (*Int32Value) XXX_WellKnownType ¶
func (*Int32Value) XXX_WellKnownType() string
type Int64Value ¶
Wrapper message for `int64`.
The JSON representation for `Int64Value` is JSON string.
type Int64Value struct {
// The int64 value.
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedInt64Value ¶
func NewPopulatedInt64Value(r randyWrappers, easy bool) *Int64Value
func (*Int64Value) Compare ¶
func (this *Int64Value) Compare(that interface{}) int
func (*Int64Value) Descriptor ¶
func (*Int64Value) Descriptor() ([]byte, []int)
func (*Int64Value) Equal ¶
func (this *Int64Value) Equal(that interface{}) bool
func (*Int64Value) GetValue ¶
func (m *Int64Value) GetValue() int64
func (*Int64Value) GoString ¶
func (this *Int64Value) GoString() string
func (*Int64Value) Marshal ¶
func (m *Int64Value) Marshal() (dAtA []byte, err error)
func (*Int64Value) MarshalTo ¶
func (m *Int64Value) MarshalTo(dAtA []byte) (int, error)
func (*Int64Value) ProtoMessage ¶
func (*Int64Value) ProtoMessage()
func (*Int64Value) Reset ¶
func (m *Int64Value) Reset()
func (*Int64Value) Size ¶
func (m *Int64Value) Size() (n int)
func (*Int64Value) String ¶
func (this *Int64Value) String() string
func (*Int64Value) Unmarshal ¶
func (m *Int64Value) Unmarshal(dAtA []byte) error
func (*Int64Value) XXX_WellKnownType ¶
func (*Int64Value) XXX_WellKnownType() string
type ListValue ¶
`ListValue` is a wrapper around a repeated field of values.
The JSON representation for `ListValue` is JSON array.
type ListValue struct {
// Repeated field of dynamically typed values.
Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
}
func NewPopulatedListValue ¶
func NewPopulatedListValue(r randyStruct, easy bool) *ListValue
func (*ListValue) Descriptor ¶
func (*ListValue) Descriptor() ([]byte, []int)
func (*ListValue) Equal ¶
func (this *ListValue) Equal(that interface{}) bool
func (*ListValue) GetValues ¶
func (m *ListValue) GetValues() []*Value
func (*ListValue) GoString ¶
func (this *ListValue) GoString() string
func (*ListValue) Marshal ¶
func (m *ListValue) Marshal() (dAtA []byte, err error)
func (*ListValue) MarshalTo ¶
func (m *ListValue) MarshalTo(dAtA []byte) (int, error)
func (*ListValue) ProtoMessage ¶
func (*ListValue) ProtoMessage()
func (*ListValue) Reset ¶
func (m *ListValue) Reset()
func (*ListValue) Size ¶
func (m *ListValue) Size() (n int)
func (*ListValue) String ¶
func (this *ListValue) String() string
func (*ListValue) Unmarshal ¶
func (m *ListValue) Unmarshal(dAtA []byte) error
func (*ListValue) XXX_WellKnownType ¶
func (*ListValue) XXX_WellKnownType() string
type NullValue ¶
`NullValue` is a singleton enumeration to represent the null value for the `Value` type union.
The JSON representation for `NullValue` is JSON `null`.
type NullValue int32
const (
// Null value.
NULL_VALUE NullValue = 0
)
func (NullValue) EnumDescriptor ¶
func (NullValue) EnumDescriptor() ([]byte, []int)
func (NullValue) String ¶
func (x NullValue) String() string
func (NullValue) XXX_WellKnownType ¶
func (NullValue) XXX_WellKnownType() string
type StringValue ¶
Wrapper message for `string`.
The JSON representation for `StringValue` is JSON string.
type StringValue struct {
// The string value.
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedStringValue ¶
func NewPopulatedStringValue(r randyWrappers, easy bool) *StringValue
func (*StringValue) Compare ¶
func (this *StringValue) Compare(that interface{}) int
func (*StringValue) Descriptor ¶
func (*StringValue) Descriptor() ([]byte, []int)
func (*StringValue) Equal ¶
func (this *StringValue) Equal(that interface{}) bool
func (*StringValue) GetValue ¶
func (m *StringValue) GetValue() string
func (*StringValue) GoString ¶
func (this *StringValue) GoString() string
func (*StringValue) Marshal ¶
func (m *StringValue) Marshal() (dAtA []byte, err error)
func (*StringValue) MarshalTo ¶
func (m *StringValue) MarshalTo(dAtA []byte) (int, error)
func (*StringValue) ProtoMessage ¶
func (*StringValue) ProtoMessage()
func (*StringValue) Reset ¶
func (m *StringValue) Reset()
func (*StringValue) Size ¶
func (m *StringValue) Size() (n int)
func (*StringValue) String ¶
func (this *StringValue) String() string
func (*StringValue) Unmarshal ¶
func (m *StringValue) Unmarshal(dAtA []byte) error
func (*StringValue) XXX_WellKnownType ¶
func (*StringValue) XXX_WellKnownType() string
type Struct ¶
`Struct` represents a structured data value, consisting of fields which map to dynamically typed values. In some languages, `Struct` might be supported by a native representation. For example, in scripting languages like JS a struct is represented as an object. The details of that representation are described together with the proto support for the language.
The JSON representation for `Struct` is JSON object.
type Struct struct {
// Unordered map of dynamically typed values.
Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
}
func NewPopulatedStruct ¶
func NewPopulatedStruct(r randyStruct, easy bool) *Struct
func (*Struct) Descriptor ¶
func (*Struct) Descriptor() ([]byte, []int)
func (*Struct) Equal ¶
func (this *Struct) Equal(that interface{}) bool
func (*Struct) GetFields ¶
func (m *Struct) GetFields() map[string]*Value
func (*Struct) GoString ¶
func (this *Struct) GoString() string
func (*Struct) Marshal ¶
func (m *Struct) Marshal() (dAtA []byte, err error)
func (*Struct) MarshalTo ¶
func (m *Struct) MarshalTo(dAtA []byte) (int, error)
func (*Struct) ProtoMessage ¶
func (*Struct) ProtoMessage()
func (*Struct) Reset ¶
func (m *Struct) Reset()
func (*Struct) Size ¶
func (m *Struct) Size() (n int)
func (*Struct) String ¶
func (this *Struct) String() string
func (*Struct) Unmarshal ¶
func (m *Struct) Unmarshal(dAtA []byte) error
func (*Struct) XXX_WellKnownType ¶
func (*Struct) XXX_WellKnownType() string
type Timestamp ¶
A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings. See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
Example 1: Compute Timestamp from POSIX `time()`.
Timestamp timestamp; timestamp.set_seconds(time(NULL)); timestamp.set_nanos(0);
Example 2: Compute Timestamp from POSIX `gettimeofday()`.
struct timeval tv; gettimeofday(&tv, NULL); Timestamp timestamp; timestamp.set_seconds(tv.tv_sec); timestamp.set_nanos(tv.tv_usec * 1000);
Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
FILETIME ft; GetSystemTimeAsFileTime(&ft); UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. Timestamp timestamp; timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
long millis = System.currentTimeMillis(); Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) .setNanos((int) ((millis % 1000) * 1000000)).build();
Example 5: Compute Timestamp from current time in Python.
now = time.time() seconds = int(now) nanos = int((now - seconds) * 10**9) timestamp = Timestamp(seconds=seconds, nanos=nanos)
type Timestamp struct { // Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` // Non-negative fractions of a second at nanosecond resolution. Negative // second values with fractions must still have non-negative nanos values // that count forward in time. Must be from 0 to 999,999,999 // inclusive. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` }
func NewPopulatedTimestamp ¶
func NewPopulatedTimestamp(r interface { Int63() int64 }, easy bool) *Timestamp
func TimestampProto ¶
func TimestampProto(t time.Time) (*Timestamp, error)
TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. It returns an error if the resulting Timestamp is invalid.
func (*Timestamp) Compare ¶
func (this *Timestamp) Compare(that interface{}) int
func (*Timestamp) Descriptor ¶
func (*Timestamp) Descriptor() ([]byte, []int)
func (*Timestamp) Equal ¶
func (this *Timestamp) Equal(that interface{}) bool
func (*Timestamp) GetNanos ¶
func (m *Timestamp) GetNanos() int32
func (*Timestamp) GetSeconds ¶
func (m *Timestamp) GetSeconds() int64
func (*Timestamp) GoString ¶
func (this *Timestamp) GoString() string
func (*Timestamp) Marshal ¶
func (m *Timestamp) Marshal() (dAtA []byte, err error)
func (*Timestamp) MarshalTo ¶
func (m *Timestamp) MarshalTo(dAtA []byte) (int, error)
func (*Timestamp) ProtoMessage ¶
func (*Timestamp) ProtoMessage()
func (*Timestamp) Reset ¶
func (m *Timestamp) Reset()
func (*Timestamp) Size ¶
func (m *Timestamp) Size() (n int)
func (*Timestamp) String ¶
func (ts *Timestamp) String() string
func (*Timestamp) Unmarshal ¶
func (m *Timestamp) Unmarshal(dAtA []byte) error
func (*Timestamp) XXX_WellKnownType ¶
func (*Timestamp) XXX_WellKnownType() string
type UInt32Value ¶
Wrapper message for `uint32`.
The JSON representation for `UInt32Value` is JSON number.
type UInt32Value struct {
// The uint32 value.
Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedUInt32Value ¶
func NewPopulatedUInt32Value(r randyWrappers, easy bool) *UInt32Value
func (*UInt32Value) Compare ¶
func (this *UInt32Value) Compare(that interface{}) int
func (*UInt32Value) Descriptor ¶
func (*UInt32Value) Descriptor() ([]byte, []int)
func (*UInt32Value) Equal ¶
func (this *UInt32Value) Equal(that interface{}) bool
func (*UInt32Value) GetValue ¶
func (m *UInt32Value) GetValue() uint32
func (*UInt32Value) GoString ¶
func (this *UInt32Value) GoString() string
func (*UInt32Value) Marshal ¶
func (m *UInt32Value) Marshal() (dAtA []byte, err error)
func (*UInt32Value) MarshalTo ¶
func (m *UInt32Value) MarshalTo(dAtA []byte) (int, error)
func (*UInt32Value) ProtoMessage ¶
func (*UInt32Value) ProtoMessage()
func (*UInt32Value) Reset ¶
func (m *UInt32Value) Reset()
func (*UInt32Value) Size ¶
func (m *UInt32Value) Size() (n int)
func (*UInt32Value) String ¶
func (this *UInt32Value) String() string
func (*UInt32Value) Unmarshal ¶
func (m *UInt32Value) Unmarshal(dAtA []byte) error
func (*UInt32Value) XXX_WellKnownType ¶
func (*UInt32Value) XXX_WellKnownType() string
type UInt64Value ¶
Wrapper message for `uint64`.
The JSON representation for `UInt64Value` is JSON string.
type UInt64Value struct {
// The uint64 value.
Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
}
func NewPopulatedUInt64Value ¶
func NewPopulatedUInt64Value(r randyWrappers, easy bool) *UInt64Value
func (*UInt64Value) Compare ¶
func (this *UInt64Value) Compare(that interface{}) int
func (*UInt64Value) Descriptor ¶
func (*UInt64Value) Descriptor() ([]byte, []int)
func (*UInt64Value) Equal ¶
func (this *UInt64Value) Equal(that interface{}) bool
func (*UInt64Value) GetValue ¶
func (m *UInt64Value) GetValue() uint64
func (*UInt64Value) GoString ¶
func (this *UInt64Value) GoString() string
func (*UInt64Value) Marshal ¶
func (m *UInt64Value) Marshal() (dAtA []byte, err error)
func (*UInt64Value) MarshalTo ¶
func (m *UInt64Value) MarshalTo(dAtA []byte) (int, error)
func (*UInt64Value) ProtoMessage ¶
func (*UInt64Value) ProtoMessage()
func (*UInt64Value) Reset ¶
func (m *UInt64Value) Reset()
func (*UInt64Value) Size ¶
func (m *UInt64Value) Size() (n int)
func (*UInt64Value) String ¶
func (this *UInt64Value) String() string
func (*UInt64Value) Unmarshal ¶
func (m *UInt64Value) Unmarshal(dAtA []byte) error
func (*UInt64Value) XXX_WellKnownType ¶
func (*UInt64Value) XXX_WellKnownType() string
type Value ¶
`Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of that variants, absence of any variant indicates an error.
The JSON representation for `Value` is JSON value.
type Value struct { // The kind of value. // // Types that are valid to be assigned to Kind: // *Value_NullValue // *Value_NumberValue // *Value_StringValue // *Value_BoolValue // *Value_StructValue // *Value_ListValue Kind isValue_Kind `protobuf_oneof:"kind"` }
func NewPopulatedValue ¶
func NewPopulatedValue(r randyStruct, easy bool) *Value
func (*Value) Descriptor ¶
func (*Value) Descriptor() ([]byte, []int)
func (*Value) Equal ¶
func (this *Value) Equal(that interface{}) bool
func (*Value) GetBoolValue ¶
func (m *Value) GetBoolValue() bool
func (*Value) GetKind ¶
func (m *Value) GetKind() isValue_Kind
func (*Value) GetListValue ¶
func (m *Value) GetListValue() *ListValue
func (*Value) GetNullValue ¶
func (m *Value) GetNullValue() NullValue
func (*Value) GetNumberValue ¶
func (m *Value) GetNumberValue() float64
func (*Value) GetStringValue ¶
func (m *Value) GetStringValue() string
func (*Value) GetStructValue ¶
func (m *Value) GetStructValue() *Struct
func (*Value) GoString ¶
func (this *Value) GoString() string
func (*Value) Marshal ¶
func (m *Value) Marshal() (dAtA []byte, err error)
func (*Value) MarshalTo ¶
func (m *Value) MarshalTo(dAtA []byte) (int, error)
func (*Value) ProtoMessage ¶
func (*Value) ProtoMessage()
func (*Value) Reset ¶
func (m *Value) Reset()
func (*Value) Size ¶
func (m *Value) Size() (n int)
func (*Value) String ¶
func (this *Value) String() string
func (*Value) Unmarshal ¶
func (m *Value) Unmarshal(dAtA []byte) error
func (*Value) XXX_OneofFuncs ¶
func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
func (*Value) XXX_WellKnownType ¶
func (*Value) XXX_WellKnownType() string
type Value_BoolValue ¶
type Value_BoolValue struct { BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` }
func NewPopulatedValue_BoolValue ¶
func NewPopulatedValue_BoolValue(r randyStruct, easy bool) *Value_BoolValue
func (*Value_BoolValue) Equal ¶
func (this *Value_BoolValue) Equal(that interface{}) bool
func (*Value_BoolValue) GoString ¶
func (this *Value_BoolValue) GoString() string
func (*Value_BoolValue) MarshalTo ¶
func (m *Value_BoolValue) MarshalTo(dAtA []byte) (int, error)
func (*Value_BoolValue) Size ¶
func (m *Value_BoolValue) Size() (n int)
func (*Value_BoolValue) String ¶
func (this *Value_BoolValue) String() string
type Value_ListValue ¶
type Value_ListValue struct { ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"` }
func NewPopulatedValue_ListValue ¶
func NewPopulatedValue_ListValue(r randyStruct, easy bool) *Value_ListValue
func (*Value_ListValue) Equal ¶
func (this *Value_ListValue) Equal(that interface{}) bool
func (*Value_ListValue) GoString ¶
func (this *Value_ListValue) GoString() string
func (*Value_ListValue) MarshalTo ¶
func (m *Value_ListValue) MarshalTo(dAtA []byte) (int, error)
func (*Value_ListValue) Size ¶
func (m *Value_ListValue) Size() (n int)
func (*Value_ListValue) String ¶
func (this *Value_ListValue) String() string
type Value_NullValue ¶
type Value_NullValue struct { NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` }
func NewPopulatedValue_NullValue ¶
func NewPopulatedValue_NullValue(r randyStruct, easy bool) *Value_NullValue
func (*Value_NullValue) Equal ¶
func (this *Value_NullValue) Equal(that interface{}) bool
func (*Value_NullValue) GoString ¶
func (this *Value_NullValue) GoString() string
func (*Value_NullValue) MarshalTo ¶
func (m *Value_NullValue) MarshalTo(dAtA []byte) (int, error)
func (*Value_NullValue) Size ¶
func (m *Value_NullValue) Size() (n int)
func (*Value_NullValue) String ¶
func (this *Value_NullValue) String() string
type Value_NumberValue ¶
type Value_NumberValue struct { NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` }
func NewPopulatedValue_NumberValue ¶
func NewPopulatedValue_NumberValue(r randyStruct, easy bool) *Value_NumberValue
func (*Value_NumberValue) Equal ¶
func (this *Value_NumberValue) Equal(that interface{}) bool
func (*Value_NumberValue) GoString ¶
func (this *Value_NumberValue) GoString() string
func (*Value_NumberValue) MarshalTo ¶
func (m *Value_NumberValue) MarshalTo(dAtA []byte) (int, error)
func (*Value_NumberValue) Size ¶
func (m *Value_NumberValue) Size() (n int)
func (*Value_NumberValue) String ¶
func (this *Value_NumberValue) String() string
type Value_StringValue ¶
type Value_StringValue struct { StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` }
func NewPopulatedValue_StringValue ¶
func NewPopulatedValue_StringValue(r randyStruct, easy bool) *Value_StringValue
func (*Value_StringValue) Equal ¶
func (this *Value_StringValue) Equal(that interface{}) bool
func (*Value_StringValue) GoString ¶
func (this *Value_StringValue) GoString() string
func (*Value_StringValue) MarshalTo ¶
func (m *Value_StringValue) MarshalTo(dAtA []byte) (int, error)
func (*Value_StringValue) Size ¶
func (m *Value_StringValue) Size() (n int)
func (*Value_StringValue) String ¶
func (this *Value_StringValue) String() string
type Value_StructValue ¶
type Value_StructValue struct { StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"` }
func NewPopulatedValue_StructValue ¶
func NewPopulatedValue_StructValue(r randyStruct, easy bool) *Value_StructValue
func (*Value_StructValue) Equal ¶
func (this *Value_StructValue) Equal(that interface{}) bool
func (*Value_StructValue) GoString ¶
func (this *Value_StructValue) GoString() string
func (*Value_StructValue) MarshalTo ¶
func (m *Value_StructValue) MarshalTo(dAtA []byte) (int, error)
func (*Value_StructValue) Size ¶
func (m *Value_StructValue) Size() (n int)
func (*Value_StructValue) String ¶
func (this *Value_StructValue) String() string