package defval
Import Path
google.golang.org/protobuf/internal/encoding/defval (on go.dev)
Dependency Relation
imports 6 packages, and imported by 3 packages
Involved Source Files
Package defval marshals and unmarshals textual forms of default values.
This package handles both the form historically used in Go struct field tags
and also the form used by google.protobuf.FieldDescriptorProto.default_value
since they differ in superficial ways.
Package-Level Type Names (only one, which is exported)
Format is the serialization format used to represent the default value.
func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error)
func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error)
const Descriptor
const GoTag
Package-Level Functions (total 4, in which 2 are exported)
Marshal serializes v as the default string according to the given kind k.
When specifying the Descriptor format for an enum kind, the associated
enum value descriptor must be provided.
Unmarshal deserializes the default string s according to the given kind k.
When k is an enum, a list of enum value descriptors must be provided.
Package-Level Constants (total 2, both are exported)
Descriptor uses the serialization format that protoc uses with the
google.protobuf.FieldDescriptorProto.default_value field.
GoTag uses the historical serialization format in Go struct field tags.
The pages are generated with Golds v0.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. |