package ptypes

Import Path
	github.com/golang/protobuf/ptypes (on go.dev)

Dependency Relation
	imports 10 packages, and imported by 6 packages

Involved Source Files any.go Package ptypes provides functionality for interacting with well-known types. duration.go timestamp.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) Message proto.Message ( T) ProtoMessage() ( T) ProtoReflect() protoreflect.Message ( T) Reset() ( T) String() string T : expvar.Var T : fmt.Stringer T : google.golang.org/protobuf/reflect/protoreflect.ProtoMessage T : google.golang.org/protobuf/runtime/protoiface.MessageV1
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.
Duration converts a durationpb.Duration to a time.Duration. Duration returns an error if dur is invalid or overflows a time.Duration.
DurationProto converts a time.Duration to a durationpb.Duration.
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.
Is reports whether the Any message contains a message of the specified type.
MarshalAny marshals the given message m into an anypb.Any message.
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.
TimestampNow returns a google.protobuf.Timestamp for the current time.
TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. It returns an error if the resulting Timestamp is invalid.
TimestampString returns the RFC 3339 string for valid Timestamps. For invalid Timestamps, it returns an error message in parentheses.
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.
Package-Level Constants (total 5, none are exported)