Documentation ¶
Index ¶
- func Format(m proto.Message) string
- func Marshal(m proto.Message) ([]byte, error)
- func Unmarshal(b []byte, m proto.Message) error
- type Encoder
- func (e *Encoder) Bytes() []byte
- func (e *Encoder) EndArray()
- func (e *Encoder) EndObject()
- func (e *Encoder) StartArray()
- func (e *Encoder) StartObject()
- func (e *Encoder) WriteBool(b bool)
- func (e *Encoder) WriteFloat(n float64, bitSize int)
- func (e *Encoder) WriteInt(n int64)
- func (e *Encoder) WriteName(s string) error
- func (e *Encoder) WriteNull()
- func (e *Encoder) WriteString(s string) error
- func (e *Encoder) WriteUint(n uint64)
- type KubeListObjectMeta
- type UnmarshalOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format formats the message as a multiline string. This function is only intended for human consumption and ignores errors. Do not depend on the output being stable. It may change over time across different versions of the program.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder provides methods to write out JSON constructs and values. The user is responsible for producing valid sequences of JSON constructs and values.
func NewEncoder ¶
NewEncoder returns an Encoder.
If indent is a non-empty string, it causes every entry for an Array or Object to be preceded by the indent and trailed by a newline.
func (*Encoder) StartObject ¶
func (e *Encoder) StartObject()
StartObject writes out the '{' symbol.
func (*Encoder) WriteFloat ¶
WriteFloat writes out the given float and bitSize in JSON number value.
func (*Encoder) WriteName ¶
WriteName writes out the given string in JSON string value and the name separator ':'. Returns error if input string contains invalid UTF-8, which should not be likely as protobuf field names should be valid.
func (*Encoder) WriteString ¶
WriteString writes out the given string in JSON string value. Returns error if input string contains invalid UTF-8.
type KubeListObjectMeta ¶
type UnmarshalOptions ¶
type UnmarshalOptions struct { // If AllowPartial is set, input for messages that will result in missing // required fields will not return an error. AllowPartial bool // If DiscardUnknown is set, unknown fields are ignored. DiscardUnknown bool // Resolver is used for looking up types when unmarshaling // google.protobuf.Any messages or extension fields. // If nil, this defaults to using protoregistry.GlobalTypes. Resolver interface { protoregistry.MessageTypeResolver protoregistry.ExtensionTypeResolver } }
UnmarshalOptions is a configurable JSON format parser.
func (UnmarshalOptions) Unmarshal ¶
func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error
Unmarshal reads the given []byte and populates the given proto.Message using options in the UnmarshalOptions object. It will clear the message first before setting the fields. If it returns an error, the given message may be partially set. The provided message must be mutable (e.g., a non-nil pointer to a message).
func (UnmarshalOptions) UnmarshalKubeList ¶
func (o UnmarshalOptions) UnmarshalKubeList(b []byte, m proto.Message, callback func(m proto.Message)) (*KubeListObjectMeta, error)