Documentation ¶
Index ¶
- Variables
- func GetEnumString(x int32, valueMaps ...map[int32]string) string
- func ParseEnumString(v string, valueMaps ...map[string]int32) (int32, error)
- type FieldMask
- type MarshalState
- func (s *MarshalState) Bytes() ([]byte, error)
- func (s *MarshalState) Config() MarshalerConfig
- func (s *MarshalState) Err() error
- func (s *MarshalState) HasField(field string) bool
- func (s *MarshalState) SetError(err error)
- func (s *MarshalState) SetErrorf(format string, a ...interface{})
- func (s *MarshalState) Sub() *MarshalState
- func (s *MarshalState) WithField(field string) *MarshalState
- func (s *MarshalState) WithFieldMask(paths ...string) *MarshalState
- func (s *MarshalState) Write(v []byte) (nn int, err error)
- func (s *MarshalState) WriteArrayEnd()
- func (s *MarshalState) WriteArrayStart()
- func (s *MarshalState) WriteBool(v bool)
- func (s *MarshalState) WriteBoolArray(vs []bool)
- func (s *MarshalState) WriteBytes(v []byte)
- func (s *MarshalState) WriteBytesArray(vs [][]byte)
- func (s *MarshalState) WriteDuration(x time.Duration)
- func (s *MarshalState) WriteEnum(x int32, valueMaps ...map[int32]string)
- func (s *MarshalState) WriteEnumNumber(x int32)
- func (s *MarshalState) WriteEnumString(x int32, valueMaps ...map[int32]string)
- func (s *MarshalState) WriteFieldMask(x FieldMask)
- func (s *MarshalState) WriteFloat32(v float32)
- func (s *MarshalState) WriteFloat32Array(vs []float32)
- func (s *MarshalState) WriteFloat64(v float64)
- func (s *MarshalState) WriteFloat64Array(vs []float64)
- func (s *MarshalState) WriteInt32(v int32)
- func (s *MarshalState) WriteInt32Array(vs []int32)
- func (s *MarshalState) WriteInt64(v int64)
- func (s *MarshalState) WriteInt64Array(vs []int64)
- func (s *MarshalState) WriteLegacyFieldMask(x FieldMask)
- func (s *MarshalState) WriteMore()
- func (s *MarshalState) WriteMoreIf(b *bool)
- func (s *MarshalState) WriteNil()
- func (s *MarshalState) WriteObjectBoolField(field bool)
- func (s *MarshalState) WriteObjectEnd()
- func (s *MarshalState) WriteObjectField(field string)
- func (s *MarshalState) WriteObjectInt32Field(field int32)
- func (s *MarshalState) WriteObjectInt64Field(field int64)
- func (s *MarshalState) WriteObjectStart()
- func (s *MarshalState) WriteObjectStringField(field string)
- func (s *MarshalState) WriteObjectUint32Field(field uint32)
- func (s *MarshalState) WriteObjectUint64Field(field uint64)
- func (s *MarshalState) WriteString(v string)
- func (s *MarshalState) WriteStringArray(vs []string)
- func (s *MarshalState) WriteTime(x time.Time)
- func (s *MarshalState) WriteUint32(v uint32)
- func (s *MarshalState) WriteUint32Array(vs []uint32)
- func (s *MarshalState) WriteUint64(v uint64)
- func (s *MarshalState) WriteUint64Array(vs []uint64)
- type Marshaler
- type MarshalerConfig
- type UnmarshalState
- func (s *UnmarshalState) AddField(field string)
- func (s *UnmarshalState) Config() UnmarshalerConfig
- func (s *UnmarshalState) Err() error
- func (s *UnmarshalState) FieldMask() FieldMask
- func (s *UnmarshalState) ReadAny()
- func (s *UnmarshalState) ReadArray(cb func())
- func (s *UnmarshalState) ReadBool() bool
- func (s *UnmarshalState) ReadBoolArray() []bool
- func (s *UnmarshalState) ReadBoolMap(cb func(key bool))
- func (s *UnmarshalState) ReadBytes() []byte
- func (s *UnmarshalState) ReadBytesArray() [][]byte
- func (s *UnmarshalState) ReadDuration() *time.Duration
- func (s *UnmarshalState) ReadEnum(valueMaps ...map[string]int32) int32
- func (s *UnmarshalState) ReadFieldMask() FieldMask
- func (s *UnmarshalState) ReadFloat32() float32
- func (s *UnmarshalState) ReadFloat32Array() []float32
- func (s *UnmarshalState) ReadFloat64() float64
- func (s *UnmarshalState) ReadFloat64Array() []float64
- func (s *UnmarshalState) ReadInt32() int32
- func (s *UnmarshalState) ReadInt32Array() []int32
- func (s *UnmarshalState) ReadInt32Map(cb func(key int32))
- func (s *UnmarshalState) ReadInt64() int64
- func (s *UnmarshalState) ReadInt64Array() []int64
- func (s *UnmarshalState) ReadInt64Map(cb func(key int64))
- func (s *UnmarshalState) ReadNil() bool
- func (s *UnmarshalState) ReadObject(cb func(key string))
- func (s *UnmarshalState) ReadObjectField() string
- func (s *UnmarshalState) ReadRawMessage() jsoniter.RawMessage
- func (s *UnmarshalState) ReadString() string
- func (s *UnmarshalState) ReadStringArray() []string
- func (s *UnmarshalState) ReadStringMap(cb func(key string))
- func (s *UnmarshalState) ReadTime() *time.Time
- func (s *UnmarshalState) ReadUint32() uint32
- func (s *UnmarshalState) ReadUint32Array() []uint32
- func (s *UnmarshalState) ReadUint32Map(cb func(key uint32))
- func (s *UnmarshalState) ReadUint64() uint64
- func (s *UnmarshalState) ReadUint64Array() []uint64
- func (s *UnmarshalState) ReadUint64Map(cb func(key uint64))
- func (s *UnmarshalState) ReadWrappedBool() bool
- func (s *UnmarshalState) ReadWrappedBytes() []byte
- func (s *UnmarshalState) ReadWrappedFloat32() float32
- func (s *UnmarshalState) ReadWrappedFloat64() float64
- func (s *UnmarshalState) ReadWrappedInt32() int32
- func (s *UnmarshalState) ReadWrappedInt64() int64
- func (s *UnmarshalState) ReadWrappedString() string
- func (s *UnmarshalState) ReadWrappedUint32() uint32
- func (s *UnmarshalState) ReadWrappedUint64() uint64
- func (s *UnmarshalState) SetError(err error)
- func (s *UnmarshalState) SetErrorf(format string, a ...interface{})
- func (s *UnmarshalState) Sub(data []byte) *UnmarshalState
- func (s *UnmarshalState) WithField(field string, mask bool) *UnmarshalState
- type Unmarshaler
- type UnmarshalerConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultMarshalerConfig = MarshalerConfig{ EnumsAsInts: true, }
DefaultMarshalerConfig is the default configuration for the Marshaler.
var DefaultUnmarshalerConfig = UnmarshalerConfig{}
DefaultUnmarshalerConfig is the default configuration for the Unmarshaler.
Functions ¶
func GetEnumString ¶ added in v1.3.0
GetEnumString gets the string representation of the enum using the value maps. If none of the value maps contains a mapping for the enum value, it returns the numeric value as a string.
func ParseEnumString ¶ added in v1.3.0
ParseEnumString parses an enum from its string representation using the value maps. If none of the value maps contains a mapping for the string value, it attempts to parse the string as a numeric value.
Types ¶
type FieldMask ¶
type FieldMask interface {
GetPaths() []string
}
FieldMask is the interface for field masks.
type MarshalState ¶
type MarshalState struct {
// contains filtered or unexported fields
}
MarshalState is the internal state of the Marshaler.
func NewMarshalState ¶
func NewMarshalState(config MarshalerConfig) *MarshalState
NewMarshalState creates a new MarshalState.
func (*MarshalState) Bytes ¶
func (s *MarshalState) Bytes() ([]byte, error)
Bytes returns the buffer of the marshaler.
func (*MarshalState) Config ¶
func (s *MarshalState) Config() MarshalerConfig
Config returns a copy of the marshaler configuration.
func (*MarshalState) Err ¶
func (s *MarshalState) Err() error
Err returns an error from the marshaler, if any.
func (*MarshalState) HasField ¶
func (s *MarshalState) HasField(field string) bool
HasField returns whether the field mask contains the given field.
func (*MarshalState) SetError ¶
func (s *MarshalState) SetError(err error)
SetError sets an error in the marshaler state. Subsequent operations become no-ops.
func (*MarshalState) SetErrorf ¶
func (s *MarshalState) SetErrorf(format string, a ...interface{})
SetErrorf calls SetError with a formatted error.
func (*MarshalState) Sub ¶
func (s *MarshalState) Sub() *MarshalState
Sub returns a sub-marshaler with a new buffer, but with the same configuration, error and path info.
func (*MarshalState) WithField ¶
func (s *MarshalState) WithField(field string) *MarshalState
WithField returns a MarshalState for the given subfield.
func (*MarshalState) WithFieldMask ¶
func (s *MarshalState) WithFieldMask(paths ...string) *MarshalState
WithFieldMask returns a MarshalState for the given field mask.
func (*MarshalState) Write ¶
func (s *MarshalState) Write(v []byte) (nn int, err error)
Write writes raw data.
func (*MarshalState) WriteArrayEnd ¶
func (s *MarshalState) WriteArrayEnd()
WriteArrayEnd writes the ending ] of an array.
func (*MarshalState) WriteArrayStart ¶
func (s *MarshalState) WriteArrayStart()
WriteArrayStart writes the starting [ of an array.
func (*MarshalState) WriteBool ¶
func (s *MarshalState) WriteBool(v bool)
WriteBool writes a bool value.
func (*MarshalState) WriteBoolArray ¶
func (s *MarshalState) WriteBoolArray(vs []bool)
WriteBoolArray writes an array of bool values.
func (*MarshalState) WriteBytes ¶
func (s *MarshalState) WriteBytes(v []byte)
WriteBytes writes a binary value.
func (*MarshalState) WriteBytesArray ¶
func (s *MarshalState) WriteBytesArray(vs [][]byte)
WriteBytesArray writes an array of binary values.
func (*MarshalState) WriteDuration ¶
func (s *MarshalState) WriteDuration(x time.Duration)
WriteDuration writes a duration value.
func (*MarshalState) WriteEnum ¶
func (s *MarshalState) WriteEnum(x int32, valueMaps ...map[int32]string)
WriteEnum writes an enum value. If config.EnumsAsInts is true or a string value is not found for the value, this writes a number.
func (*MarshalState) WriteEnumNumber ¶
func (s *MarshalState) WriteEnumNumber(x int32)
WriteEnumNumber writes an enum value as a number.
func (*MarshalState) WriteEnumString ¶
func (s *MarshalState) WriteEnumString(x int32, valueMaps ...map[int32]string)
WriteEnumString writes an enum value as a string.
func (*MarshalState) WriteFieldMask ¶
func (s *MarshalState) WriteFieldMask(x FieldMask)
WriteFieldMask writes a field mask value.
func (*MarshalState) WriteFloat32 ¶
func (s *MarshalState) WriteFloat32(v float32)
WriteFloat32 writes a float32 value.
func (*MarshalState) WriteFloat32Array ¶
func (s *MarshalState) WriteFloat32Array(vs []float32)
WriteFloat32Array writes an array of float32 values.
func (*MarshalState) WriteFloat64 ¶
func (s *MarshalState) WriteFloat64(v float64)
WriteFloat64 writes a float64 value.
func (*MarshalState) WriteFloat64Array ¶
func (s *MarshalState) WriteFloat64Array(vs []float64)
WriteFloat64Array writes an array of float64 values.
func (*MarshalState) WriteInt32 ¶
func (s *MarshalState) WriteInt32(v int32)
WriteInt32 writes an int32 value.
func (*MarshalState) WriteInt32Array ¶
func (s *MarshalState) WriteInt32Array(vs []int32)
WriteInt32Array writes an array of int32 values.
func (*MarshalState) WriteInt64 ¶
func (s *MarshalState) WriteInt64(v int64)
WriteInt64 writes an int64 value as a string.
func (*MarshalState) WriteInt64Array ¶
func (s *MarshalState) WriteInt64Array(vs []int64)
WriteInt64Array writes an array of int64 values.
func (*MarshalState) WriteLegacyFieldMask ¶ added in v1.4.2
func (s *MarshalState) WriteLegacyFieldMask(x FieldMask)
func (*MarshalState) WriteMoreIf ¶
func (s *MarshalState) WriteMoreIf(b *bool)
WriteMoreIf writes a comma if b is false, and sets b to true.
func (*MarshalState) WriteObjectBoolField ¶
func (s *MarshalState) WriteObjectBoolField(field bool)
WriteObjectBoolField writes a field name and colon.
func (*MarshalState) WriteObjectEnd ¶
func (s *MarshalState) WriteObjectEnd()
WriteObjectEnd writes the ending } of an object.
func (*MarshalState) WriteObjectField ¶
func (s *MarshalState) WriteObjectField(field string)
WriteObjectField writes a field name and colon.
func (*MarshalState) WriteObjectInt32Field ¶
func (s *MarshalState) WriteObjectInt32Field(field int32)
WriteObjectInt32Field writes a field name and colon.
func (*MarshalState) WriteObjectInt64Field ¶
func (s *MarshalState) WriteObjectInt64Field(field int64)
WriteObjectInt64Field writes a field name and colon.
func (*MarshalState) WriteObjectStart ¶
func (s *MarshalState) WriteObjectStart()
WriteObjectStart writes the starting { of an object.
func (*MarshalState) WriteObjectStringField ¶
func (s *MarshalState) WriteObjectStringField(field string)
WriteObjectStringField writes a field name and colon.
func (*MarshalState) WriteObjectUint32Field ¶
func (s *MarshalState) WriteObjectUint32Field(field uint32)
WriteObjectUint32Field writes a field name and colon.
func (*MarshalState) WriteObjectUint64Field ¶
func (s *MarshalState) WriteObjectUint64Field(field uint64)
WriteObjectUint64Field writes a field name and colon.
func (*MarshalState) WriteString ¶
func (s *MarshalState) WriteString(v string)
WriteString writes a string.
func (*MarshalState) WriteStringArray ¶
func (s *MarshalState) WriteStringArray(vs []string)
WriteStringArray writes an array of string values.
func (*MarshalState) WriteTime ¶
func (s *MarshalState) WriteTime(x time.Time)
WriteTime writes a time value.
func (*MarshalState) WriteUint32 ¶
func (s *MarshalState) WriteUint32(v uint32)
WriteUint32 writes a uint32 value.
func (*MarshalState) WriteUint32Array ¶
func (s *MarshalState) WriteUint32Array(vs []uint32)
WriteUint32Array writes an array of uint32 values.
func (*MarshalState) WriteUint64 ¶
func (s *MarshalState) WriteUint64(v uint64)
WriteUint64 writes a uint64 value as a string.
func (*MarshalState) WriteUint64Array ¶
func (s *MarshalState) WriteUint64Array(vs []uint64)
WriteUint64Array writes an array of uint64 values.
type Marshaler ¶
type Marshaler interface {
MarshalProtoJSON(*MarshalState)
}
Marshaler is the interface implemented by types that are supported by this plugin.
type MarshalerConfig ¶
type MarshalerConfig struct {
EnumsAsInts bool
}
MarshalerConfig is the configuration for the Marshaler.
type UnmarshalState ¶
type UnmarshalState struct {
// contains filtered or unexported fields
}
UnmarshalState is the internal state of the Unmarshaler.
func NewUnmarshalState ¶
func NewUnmarshalState(data []byte, config UnmarshalerConfig) *UnmarshalState
NewUnmarshalState creates a new UnmarshalState.
func (*UnmarshalState) AddField ¶
func (s *UnmarshalState) AddField(field string)
AddField registers a field in the field mask of the unmarshaler state.
func (*UnmarshalState) Config ¶
func (s *UnmarshalState) Config() UnmarshalerConfig
Config returns a copy of the unmarshaler configuration.
func (*UnmarshalState) Err ¶
func (s *UnmarshalState) Err() error
Err returns an error from the marshaler, if any.
func (*UnmarshalState) FieldMask ¶
func (s *UnmarshalState) FieldMask() FieldMask
FieldMask returns the field mask containing the unmarshaled fields.
func (*UnmarshalState) ReadAny ¶
func (s *UnmarshalState) ReadAny()
ReadAny reads any type and ignores it.
func (*UnmarshalState) ReadArray ¶
func (s *UnmarshalState) ReadArray(cb func())
ReadArray reads all array elements, and calls cb for each. cb must always read the value of the element.
func (*UnmarshalState) ReadBool ¶
func (s *UnmarshalState) ReadBool() bool
ReadBool reads a bool value.
func (*UnmarshalState) ReadBoolArray ¶
func (s *UnmarshalState) ReadBoolArray() []bool
ReadBoolArray reads an array of bool values.
func (*UnmarshalState) ReadBoolMap ¶
func (s *UnmarshalState) ReadBoolMap(cb func(key bool))
ReadBoolMap reads an object where the keys are bool, and calls cb for each field. cb must always read the value of the field.
func (*UnmarshalState) ReadBytes ¶
func (s *UnmarshalState) ReadBytes() []byte
ReadBytes reads a string value.
func (*UnmarshalState) ReadBytesArray ¶
func (s *UnmarshalState) ReadBytesArray() [][]byte
ReadBytesArray reads an array of []byte values.
func (*UnmarshalState) ReadDuration ¶
func (s *UnmarshalState) ReadDuration() *time.Duration
ReadDuration reads a duration.
func (*UnmarshalState) ReadEnum ¶
func (s *UnmarshalState) ReadEnum(valueMaps ...map[string]int32) int32
ReadEnum reads an enum. It supports numeric values and string values.
func (*UnmarshalState) ReadFieldMask ¶
func (s *UnmarshalState) ReadFieldMask() FieldMask
ReadFieldMask reads a field mask value.
func (*UnmarshalState) ReadFloat32 ¶
func (s *UnmarshalState) ReadFloat32() float32
ReadFloat32 reads a float32 value. This also supports string encoding.
func (*UnmarshalState) ReadFloat32Array ¶
func (s *UnmarshalState) ReadFloat32Array() []float32
ReadFloat32Array reads an array of float32 values.
func (*UnmarshalState) ReadFloat64 ¶
func (s *UnmarshalState) ReadFloat64() float64
ReadFloat64 reads a float64 value. This also supports string encoding.
func (*UnmarshalState) ReadFloat64Array ¶
func (s *UnmarshalState) ReadFloat64Array() []float64
ReadFloat64Array reads an array of float64 values.
func (*UnmarshalState) ReadInt32 ¶
func (s *UnmarshalState) ReadInt32() int32
ReadInt32 reads a int32 value. This also supports string encoding.
func (*UnmarshalState) ReadInt32Array ¶
func (s *UnmarshalState) ReadInt32Array() []int32
ReadInt32Array reads an array of int32 values.
func (*UnmarshalState) ReadInt32Map ¶
func (s *UnmarshalState) ReadInt32Map(cb func(key int32))
ReadInt32Map reads an object where the keys are int32, and calls cb for each field. cb must always read the value of the field.
func (*UnmarshalState) ReadInt64 ¶
func (s *UnmarshalState) ReadInt64() int64
ReadInt64 reads a int64 value. This also supports string encoding.
func (*UnmarshalState) ReadInt64Array ¶
func (s *UnmarshalState) ReadInt64Array() []int64
ReadInt64Array reads an array of int64 values.
func (*UnmarshalState) ReadInt64Map ¶
func (s *UnmarshalState) ReadInt64Map(cb func(key int64))
ReadInt64Map reads an object where the keys are int64, and calls cb for each field. cb must always read the value of the field.
func (*UnmarshalState) ReadNil ¶
func (s *UnmarshalState) ReadNil() bool
ReadNil reads a null, if there is one.
func (*UnmarshalState) ReadObject ¶
func (s *UnmarshalState) ReadObject(cb func(key string))
ReadObject reads all object fields, and calls cb for each. cb must always read the value of the field.
func (*UnmarshalState) ReadObjectField ¶
func (s *UnmarshalState) ReadObjectField() string
ReadObjectField reads a single object field. An empty string indicates the end of the object.
func (*UnmarshalState) ReadRawMessage ¶
func (s *UnmarshalState) ReadRawMessage() jsoniter.RawMessage
ReadRawMessage reads a raw JSON message.
func (*UnmarshalState) ReadString ¶
func (s *UnmarshalState) ReadString() string
ReadString reads a string value.
func (*UnmarshalState) ReadStringArray ¶
func (s *UnmarshalState) ReadStringArray() []string
ReadStringArray reads an array of string values.
func (*UnmarshalState) ReadStringMap ¶
func (s *UnmarshalState) ReadStringMap(cb func(key string))
ReadStringMap reads an object where the keys are string, and calls cb for each field. cb must always read the value of the field.
func (*UnmarshalState) ReadTime ¶
func (s *UnmarshalState) ReadTime() *time.Time
ReadTime reads a time.
func (*UnmarshalState) ReadUint32 ¶
func (s *UnmarshalState) ReadUint32() uint32
ReadUint32 reads a uint32 value. This also supports string encoding.
func (*UnmarshalState) ReadUint32Array ¶
func (s *UnmarshalState) ReadUint32Array() []uint32
ReadUint32Array reads an array of uint32 values.
func (*UnmarshalState) ReadUint32Map ¶
func (s *UnmarshalState) ReadUint32Map(cb func(key uint32))
ReadUint32Map reads an object where the keys are uint32, and calls cb for each field. cb must always read the value of the field.
func (*UnmarshalState) ReadUint64 ¶
func (s *UnmarshalState) ReadUint64() uint64
ReadUint64 reads a uint64 value. This also supports string encoding.
func (*UnmarshalState) ReadUint64Array ¶
func (s *UnmarshalState) ReadUint64Array() []uint64
ReadUint64Array reads an array of uint64 values.
func (*UnmarshalState) ReadUint64Map ¶
func (s *UnmarshalState) ReadUint64Map(cb func(key uint64))
ReadUint64Map reads an object where the keys are uint64, and calls cb for each field. cb must always read the value of the field.
func (*UnmarshalState) ReadWrappedBool ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedBool() bool
ReadWrappedBool reads a wrapped bool value. This also supports {"value": ...}.
func (*UnmarshalState) ReadWrappedBytes ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedBytes() []byte
ReadWrappedBytes reads a wrapped bytes value. This also supports {"value": ...}.
func (*UnmarshalState) ReadWrappedFloat32 ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedFloat32() float32
ReadWrappedFloat32 reads a wrapped float32 value. This also supports string encoding as well as {"value": ...}.
func (*UnmarshalState) ReadWrappedFloat64 ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedFloat64() float64
ReadWrappedFloat64 reads a wrapped float64 value. This also supports string encoding as well as {"value": ...}.
func (*UnmarshalState) ReadWrappedInt32 ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedInt32() int32
ReadWrappedInt32 reads a wrapped int32 value. This also supports string encoding as well as {"value": ...}.
func (*UnmarshalState) ReadWrappedInt64 ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedInt64() int64
ReadWrappedInt64 reads a wrapped int64 value. This also supports string encoding as well as {"value": ...}.
func (*UnmarshalState) ReadWrappedString ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedString() string
ReadWrappedString reads a wrapped string value. This also supports {"value": ...}.
func (*UnmarshalState) ReadWrappedUint32 ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedUint32() uint32
ReadWrappedUint32 reads a wrapped uint32 value. This also supports string encoding as well as {"value": ...}.
func (*UnmarshalState) ReadWrappedUint64 ¶ added in v1.4.0
func (s *UnmarshalState) ReadWrappedUint64() uint64
ReadWrappedUint64 reads a wrapped uint64 value. This also supports string encoding as well as {"value": ...}.
func (*UnmarshalState) SetError ¶
func (s *UnmarshalState) SetError(err error)
SetError sets an error in the unmarshaler state. Subsequent operations become no-ops.
func (*UnmarshalState) SetErrorf ¶
func (s *UnmarshalState) SetErrorf(format string, a ...interface{})
SetErrorf calls SetError with a formatted error.
func (*UnmarshalState) Sub ¶
func (s *UnmarshalState) Sub(data []byte) *UnmarshalState
Sub returns a subunmarshaler with a new buffer, but with the same configuration, error and path info.
func (*UnmarshalState) WithField ¶
func (s *UnmarshalState) WithField(field string, mask bool) *UnmarshalState
WithField returns a UnmarshalState for the given subfield.
type Unmarshaler ¶
type Unmarshaler interface {
UnmarshalProtoJSON(*UnmarshalState)
}
Unmarshaler is the interface implemented by types that are supported by this plugin.
type UnmarshalerConfig ¶
type UnmarshalerConfig struct{}
UnmarshalerConfig is the configuration for the Unmarshaler.
func (UnmarshalerConfig) Unmarshal ¶
func (c UnmarshalerConfig) Unmarshal(data []byte, m Unmarshaler) error
Unmarshal unmarshals a message.