message

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format() format.Format[Message[[]byte, []byte]]

Types

type Bytes

type Bytes = []byte

type Message

type Message[K any, V any] struct {
	Topic     string
	Partition int32
	Offset    int64
	Key       K
	Value     V
	Headers   map[string][]Bytes
	Timestamp time.Time
}

func Convert

func Convert[K1 any, V1 any, K2 any, V2 any](
	source Message[K1, V1],
	k1 format.Format[K1],
	v1 format.Format[V1],
	k2 format.Format[K2],
	v2 format.Format[V2],
) (Message[K2, V2], error)

assuming byte compatibility, i.e. bytes <-> proto, string <-> json

type MessageFormat

type MessageFormat struct{}

for byte based storage of a message

func (MessageFormat) Default

func (helper MessageFormat) Default() Message[[]byte, []byte]

func (MessageFormat) FromJson

func (helper MessageFormat) FromJson(value []byte) (Message[[]byte, []byte], error)

func (MessageFormat) Marshal

func (helper MessageFormat) Marshal(value Message[[]byte, []byte]) ([]byte, error)

func (MessageFormat) ToJson

func (helper MessageFormat) ToJson(value Message[[]byte, []byte]) ([]byte, error)

func (MessageFormat) Unmarshal

func (helper MessageFormat) Unmarshal(value []byte) (Message[[]byte, []byte], error)

Jump to

Keyboard shortcuts

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