buf: github.com/bufbuild/buf/internal/pkg/protoencoding Index | Files

package protoencoding

import "github.com/bufbuild/buf/internal/pkg/protoencoding"

Index

Package Files

json_marshaler.go json_unmarshaler.go protoencoding.go resolver.go wire_marshaler.go wire_unmarshaler.go

type Marshaler Uses

type Marshaler interface {
    Marshal(message proto.Message) ([]byte, error)
}

Marshaler marshals Messages.

func NewJSONMarshaler Uses

func NewJSONMarshaler(resolver Resolver) Marshaler

NewJSONMarshaler returns a new Marshaler for JSON.

This has the potential to be unstable over time. resolver can be nil if unknown and are only needed for extensions.

func NewJSONMarshalerIndent Uses

func NewJSONMarshalerIndent(resolver Resolver) Marshaler

NewJSONMarshalerIndent returns a new Marshaler for JSON with indents.

This has the potential to be unstable over time. resolver can be nil if unknown and are only needed for extensions.

func NewJSONMarshalerUseProtoNames Uses

func NewJSONMarshalerUseProtoNames(resolver Resolver) Marshaler

NewJSONMarshalerUseProtoNames returns a new Marshaler for JSON using the proto names for keys.

This has the potential to be unstable over time. resolver can be nil if unknown and are only needed for extensions.

func NewWireMarshaler Uses

func NewWireMarshaler() Marshaler

NewWireMarshaler returns a new Marshaler for wire.

See https://godoc.org/google.golang.org/protobuf/proto#MarshalOptions for a discussion on stability. This has the potential to be unstable over time.

type Resolver Uses

type Resolver interface {
    protoregistry.ExtensionTypeResolver
    protoregistry.MessageTypeResolver
}

Resolver is a Resolver.

This is only needed in cases where extensions may be present.

func NewResolver Uses

func NewResolver(fileDescriptorProtos ...*descriptorpb.FileDescriptorProto) (Resolver, error)

NewResolver creates a New Resolver.

If the input slice is empty, this returns nil The given FileDescriptorProtos must be self-contained, that is they must contain all imports. This can NOT be guaranteed for FileDescriptorSets given over the wire, and can only be guaranteed from builds.

type Unmarshaler Uses

type Unmarshaler interface {
    Unmarshal(data []byte, message proto.Message) error
}

Unmarshaler unmarshals Messages.

func NewJSONUnmarshaler Uses

func NewJSONUnmarshaler(resolver Resolver) Unmarshaler

NewJSONUnmarshaler returns a new Unmarshaler for json.

resolver can be nil if unknown and are only needed for extensions.

func NewWireUnmarshaler Uses

func NewWireUnmarshaler(resolver Resolver) Unmarshaler

NewWireUnmarshaler returns a new Unmarshaler for wire.

resolver can be nil if unknown and are only needed for extensions.

Package protoencoding imports 9 packages (graph) and is imported by 5 packages. Updated 2020-07-25. Refresh now. Tools for package owners.