Involved Source Filesany.go
Package ptypes provides functionality for interacting with well-known types.
Deprecated: Well-known types have specialized functionality directly
injected into the generated packages for each message type.
See the deprecation notice for each function for the suggested alternative.
duration.gotimestamp.go
Package-Level Type Names (total 3, in which 1 are exported)
/* sort exporteds by: | */
DynamicAny is a value that can be passed to UnmarshalAny to automatically
allocate a proto.Message for the type specified in an anypb.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)
Deprecated: Use the any.UnmarshalNew method instead to unmarshal
the any message contents into a new instance of the underlying message.
Messageproto.Message( T) ProtoMessage()( T) ProtoReflect() protoreflect.Message( T) Reset()( T) String() string
T : fmt.Stringer
T : google.golang.org/protobuf/reflect/protoreflect.ProtoMessage
T : google.golang.org/protobuf/runtime/protoiface.MessageV1
T : context.stringer
T : os/signal.stringer
T : runtime.stringer
Messageprotoreflect.Message
Clear clears the field such that a subsequent Has call reports false.
Clearing an extension field clears both the extension type and value
associated with the given field number.
Clear is a mutating operation and unsafe for concurrent use.
Descriptor returns message descriptor, which contains only the protobuf
type information for the message.
Get retrieves the value for a field.
For unpopulated scalars, it returns the default value, where
the default value of a bytes scalar is guaranteed to be a copy.
For unpopulated composite types, it returns an empty, read-only view
of the value; to obtain a mutable reference, use Mutable.
GetUnknown retrieves the entire list of unknown fields.
The caller may only mutate the contents of the RawFields
if the mutated bytes are stored back into the message with SetUnknown.
Has reports whether a field is populated.
Some fields have the property of nullability where it is possible to
distinguish between the default value of a field and whether the field
was explicitly populated with the default value. Singular message fields,
member fields of a oneof, and proto2 scalar fields are nullable. Such
fields are populated only if explicitly set.
In other cases (aside from the nullable cases above),
a proto3 scalar field is populated if it contains a non-zero value, and
a repeated field is populated if it is non-empty.
( T) Interface() protoreflect.ProtoMessage
IsValid reports whether the message is valid.
An invalid message is an empty, read-only value.
An invalid message often corresponds to a nil pointer of the concrete
message type, but the details are implementation dependent.
Validity is not part of the protobuf data model, and may not
be preserved in marshaling or other operations.
Mutable returns a mutable reference to a composite type.
If the field is unpopulated, it may allocate a composite value.
For a field belonging to a oneof, it implicitly clears any other field
that may be currently set within the same oneof.
For extension fields, it implicitly stores the provided ExtensionType
if not already stored.
It panics if the field does not contain a composite type.
Mutable is a mutating operation and unsafe for concurrent use.
( T) New() protoreflect.Message
NewField returns a new value that is assignable to the field
for the given descriptor. For scalars, this returns the default value.
For lists, maps, and messages, this returns a new, empty, mutable value.
ProtoMethods returns optional fast-path implementions of various operations.
This method may return nil.
The returned methods type is identical to
"google.golang.org/protobuf/runtime/protoiface".Methods.
Consult the protoiface package documentation for details.
Range iterates over every populated field in an undefined order,
calling f for each field descriptor and value encountered.
Range returns immediately if f returns false.
While iterating, mutating operations may only be performed
on the current field descriptor.
Set stores the value for a field.
For a field belonging to a oneof, it implicitly clears any other field
that may be currently set within the same oneof.
For extension fields, it implicitly stores the provided ExtensionType.
When setting a composite type, it is unspecified whether the stored value
aliases the source's memory in any way. If the composite value is an
empty, read-only value, then it panics.
Set is a mutating operation and unsafe for concurrent use.
SetUnknown stores an entire list of unknown fields.
The raw fields must be syntactically valid according to the wire format.
An implementation may panic if this is not the case.
Once stored, the caller must not mutate the content of the RawFields.
An empty RawFields may be passed to clear the fields.
SetUnknown is a mutating operation and unsafe for concurrent use.
( T) Type() protoreflect.MessageType
WhichOneof reports which field within the oneof is populated,
returning nil if none are populated.
It panics if the oneof descriptor does not belong to this message.
T : google.golang.org/protobuf/internal/order.FieldRanger
T : google.golang.org/protobuf/reflect/protoreflect.Message
Package-Level Functions (total 14, in which 11 are exported)
AnyMessageName returns the message name contained in an anypb.Any message.
Most type assertions should use the Is function instead.
Deprecated: Call the any.MessageName method instead.
Duration converts a durationpb.Duration to a time.Duration.
Duration returns an error if dur is invalid or overflows a time.Duration.
Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead.
DurationProto converts a time.Duration to a durationpb.Duration.
Deprecated: Call the durationpb.New function instead.
Empty returns a new message of the type specified in an anypb.Any message.
It returns protoregistry.NotFound if the corresponding message type could not
be resolved in the global registry.
Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead
to resolve the message name and create a new instance of it.
Is reports whether the Any message contains a message of the specified type.
Deprecated: Call the any.MessageIs method instead.
MarshalAny marshals the given message m into an anypb.Any message.
Deprecated: Call the anypb.New function instead.
Timestamp converts a timestamppb.Timestamp 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.
Deprecated: Call the ts.AsTime and ts.CheckValid methods instead.
TimestampNow returns a google.protobuf.Timestamp for the current time.
Deprecated: Call the timestamppb.Now function instead.
TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
It returns an error if the resulting Timestamp is invalid.
Deprecated: Call the timestamppb.New function instead.
TimestampString returns the RFC 3339 string for valid Timestamps.
For invalid Timestamps, it returns an error message in parentheses.
Deprecated: Call the ts.AsTime method instead,
followed by a call to the Format method on the time.Time value.
UnmarshalAny unmarshals the encoded value contained in the anypb.Any message
into the provided message m. It returns an error if the target message
does not match the type in the Any message or if an unmarshal error occurs.
The target message m may be a *DynamicAny message. If the underlying message
type could not be resolved, then this returns protoregistry.NotFound.
Deprecated: Call the any.UnmarshalTo method instead.
validateDuration determines whether the durationpb.Duration is valid
according to the definition in google/protobuf/duration.proto.
A valid durpb.Duration may still be too large to fit into a time.Duration
Note that the range of durationpb.Duration is about 10,000 years,
while the range of time.Duration is about 290 years.
validateTimestamp determines whether a Timestamp is valid.
A valid timestamp represents a time in the range [0001-01-01, 10000-01-01)
and has a Nanos field in the range [0, 1e9).
If the Timestamp is valid, validateTimestamp returns nil.
Otherwise, it returns an error that describes the problem.
Every valid Timestamp can be represented by a time.Time,
but the converse is not true.
Package-Level Constants (total 5, none are exported)
Range of google.protobuf.Duration as specified in duration.proto.
This is about 10,000 years in seconds.
Seconds field just after the latest valid Timestamp.
This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
Range of google.protobuf.Duration as specified in duration.proto.
This is about 10,000 years in seconds.
Seconds field of the earliest valid Timestamp.
This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.