Documentation ¶
Index ¶
- Constants
- func Marshal(m proto.Message) ([]byte, error)
- type Encoder
- func (e *Encoder) Bytes() []byte
- func (e *Encoder) EndArray()
- func (e *Encoder) EndObject()
- func (e *Encoder) EndString()
- func (e *Encoder) StartArray()
- func (e *Encoder) StartObject()
- func (e *Encoder) StartString()
- func (e *Encoder) WriteBool(b bool)
- func (e *Encoder) WriteIndexedList(i int)
- func (e *Encoder) WriteKey(s string) error
- func (e *Encoder) WriteNull()
- func (e *Encoder) WriteNumber(number string)
- func (e *Encoder) WriteString(s string) error
- type EncodingRun
- type GoogleWellKnownTypesMarshaler
- type JsonName
- type LuaMarshalOption
- type MarshalFunc
- type ProtobufName
Constants ¶
View Source
const ArrayClose = "}"
View Source
const ArrayOpen = "{"
View Source
const BeginString = "\""
View Source
const BoolFalse = "false"
View Source
const BoolTrue = "true"
View Source
const DefaultIndent = " "
View Source
const EndString = "\""
View Source
const KeyAssign = "="
View Source
const NullValue = "nil"
View Source
const TableClose = "}"
View Source
const TableOpen = "{"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func (*Encoder) StartArray ¶
func (e *Encoder) StartArray()
func (*Encoder) StartObject ¶
func (e *Encoder) StartObject()
func (*Encoder) StartString ¶
func (e *Encoder) StartString()
func (*Encoder) WriteIndexedList ¶
func (*Encoder) WriteNumber ¶
func (*Encoder) WriteString ¶
WriteString escaped the string according to rules needed for luatex
type EncodingRun ¶
type EncodingRun struct { *Encoder // contains filtered or unexported fields }
type GoogleWellKnownTypesMarshaler ¶
type GoogleWellKnownTypesMarshaler struct { }
func (GoogleWellKnownTypesMarshaler) Handle ¶
func (GoogleWellKnownTypesMarshaler) Handle(fullName protoreflect.FullName) (MarshalFunc, error)
GoogleWellKnownTypesMarshaler returns a marshal function for message of the package "google.protobuf" it returns an error in case of types of this packages are not supported yet. it returns nil if the package is different.
type JsonName ¶
type JsonName struct { }
default for KeyName, will use the jsonName for keys. Except for the root messages where the json name can not be extracted.
type LuaMarshalOption ¶
type LuaMarshalOption struct { Format struct { // If set to false the output is formated as one line (default) // If set to true the output is formated in multiple line with indent (better for humans) Multiline bool } // Defines how the name of message are crated // If set to nil, [protolua.JsonName] will be used KeyName interface { // contains filtered or unexported methods } // Additional Marshalers for non standard proto messages // see [protolua.GoogleWellKnownTypesMarshaler] for an example AdditionalMarshalers []interface { Handle(fullName protoreflect.FullName) (MarshalFunc, error) } }
type MarshalFunc ¶
type MarshalFunc func(EncodingRun, protoreflect.Message) error
Click to show internal directories.
Click to hide internal directories.