Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDuration ¶
func ParseDuration(str string) (*durationpb.Duration, error)
ParseDuration parses a duration string into a durationpb.Duration.
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
This function supports the full range of durationpb.Duration values, including those outside the range of time.Duration.
Types ¶
type MarshalOptions ¶
type MarshalOptions struct { // The number of spaces to indent. Passed to yaml.Encoder.SetIndent. // If 0, uses the default indent of yaml.v3. Indent int // AllowPartial allows messages that have missing required fields to marshal // without returning an error. AllowPartial bool // UseProtoNames uses proto field name instead of lowerCamelCase name in YAML // field names. UseProtoNames bool // UseEnumNumbers emits enum values as numbers. UseEnumNumbers bool // EmitUnpopulated specifies whether to emit unpopulated fields. EmitUnpopulated bool // Resolver is used for looking up types when expanding google.protobuf.Any // messages. If nil, this defaults to using protoregistry.GlobalTypes. Resolver interface { protoregistry.ExtensionTypeResolver protoregistry.MessageTypeResolver } }
MarshalOptions is a configurable YAML format marshaller.
It uses similar options to protojson.MarshalOptions.
type UnmarshalOptions ¶
type UnmarshalOptions struct { // The path for the data being unmarshaled. // // If set, this will be used when producing error messages. Path string // Validator is a validator to run after unmarshaling a message. Validator Validator // Resolver is the Protobuf type resolver to use. Resolver interface { protoregistry.MessageTypeResolver protoregistry.ExtensionTypeResolver } // If AllowPartial is set, input for messages that will result in missing // required fields will not return an error. AllowPartial bool // DiscardUnknown specifies whether to discard unknown fields instead of // returning an error. DiscardUnknown bool }
UnmarshalOptions is a configurable YAML format parser for Protobuf messages.
Click to show internal directories.
Click to hide internal directories.