protobuf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullyQualifiedStructName

func FullyQualifiedStructName(v interface{}) string

FullyQualifiedStructName name returns object name in format [package].[type name]. It ignores if the value is a pointer or not.

func NamedStruct

func NamedStruct(fallback func(v interface{}) string) func(v interface{}) string

NamedStruct returns the name from a message implementing the following interface:

type namedStruct interface {
	Name() string
}

It ignores if the value is a pointer or not.

func StructName

func StructName(v interface{}) string

StructName name returns struct name in format [type name]. It ignores if the value is a pointer or not.

Types

type NoProtoMessageError

type NoProtoMessageError struct {
	// contains filtered or unexported fields
}

NoProtoMessageError is returned when the given value does not implement proto.Message.

func (NoProtoMessageError) Error

func (e NoProtoMessageError) Error() string

type ProtobufMarshaler

type ProtobufMarshaler struct {
	NewUUID      func() string
	GenerateName func(v interface{}) string
}

ProtobufMarshaler is the default Protocol Buffers marshaler.

func (ProtobufMarshaler) Marshal

func (m ProtobufMarshaler) Marshal(v interface{}) (*message.Message, error)

Marshal marshals the given protobuf's message into watermill's Message.

func (ProtobufMarshaler) Name

func (m ProtobufMarshaler) Name(cmdOrEvent interface{}) string

Name returns the command or event's name.

func (ProtobufMarshaler) NameFromMessage

func (m ProtobufMarshaler) NameFromMessage(msg *message.Message) string

NameFromMessage returns the metadata name value for a given Message.

func (ProtobufMarshaler) Unmarshal

func (ProtobufMarshaler) Unmarshal(msg *message.Message, v interface{}) (err error)

Unmarshal unmarshals given watermill's Message into protobuf's message.

Jump to

Keyboard shortcuts

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