header

package
v0.0.0-...-a26ebea Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyMustBeSet = validation.NewError(
	"header_key_must_be_set",
	"the header key must be set and cannot be an empty string",
)

ErrKeyMustBeSet is the validation check error returned when the header key is an empty string.

Functions

This section is empty.

Types

type Header struct {
	Key string `json:"key"`
	Val []byte `json:"val"`
}

Header represents the key/value pair for a Kafka message.

func Generate

func Generate(rand *rand.Rand) Header

Generate a random Header value.

func New

func New(key string, val []byte) (Header, validation.ErrorGroup)

New creates and validates a new Header from the given key/val.

func (Header) Check

func (h Header) Check() validation.ErrorGroup

Check runs default validation checks for the Header.

func (Header) Equals

func (h Header) Equals(v any) bool

Equals compares two Header instances for equality.

Interface: comparison.Equaler

func (Header) Generate

func (Header) Generate(rand *rand.Rand, size int) reflect.Value

Generate random Header values.

Interface: quick.Generator

func (Header) MarshalBinary

func (h Header) MarshalBinary() (data []byte, err error)

MarshalBinary converts the Header instance to binary form.

Interface: encoding.BinaryMarshaler

func (Header) MarshalBinaryWriter

func (h Header) MarshalBinaryWriter(w io.Writer) (err error)

MarshalBinaryWriter populates the io.Writer with Header data in its binary form.

func (Header) String

func (h Header) String() string

String value of the Header.

Interface: fmt.Stringer.

func (*Header) UnmarshalBinary

func (h *Header) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary converts the binary form to a Header instance.

Interface: encoding.BinaryUnmarshaler

func (*Header) UnmarshalBinaryReader

func (h *Header) UnmarshalBinaryReader(r io.Reader) (err error)

UnmarshalBinaryReader populates Header from an io.Reader returning the binary form.

Jump to

Keyboard shortcuts

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