pblite

package
v0.0.0-...-d866a33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

pblite

pblite is a codec for protobufs where the encoded data has keys removed and is packed into order dependent JSON arrays. All option fields with numbers before a set field must but included as the array position maps directly to the field number.

For example say you have the following .proto file.

message Simple {
	optional int32 Foo = 1;
	optional int32 Bar = 2;
}

We'll create a message where we only set field 2.

simple := &pb.Simple {
	Bar: int32ptr(42),
}

This will be encoded as the following JSON array.

[0, 42]

This obviously gets a lot more complicated with messages and lists, but the concept is the same regardless. If you only set the first value, the second value can be skipped as it is optional.

errata

Currently maps are not implemented as there hasn't been a need yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(m proto.Message) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte, m proto.Message) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL