avro

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package avro decodes Avro binary fields for the Lambda Kafka consumer.

New creates a Kafka field configuration from an Avro schema string; schema parsing and record decoding remain lazy. Deserialize can decode one Base64 datum directly using the same adapter contract.

Input boundaries

The decoder rejects truncated input, trailing data and unsafe long values. Schema-registry metadata does not alter Avro decoding in the pinned reference. The application selects the schema and configures event delivery; this adapter does not contact a schema registry or Kafka broker.

This optional module keeps Avro dependencies out of the core Kafka consumer.

For usage and compatibility details, see the user guide.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(ctx context.Context, data string, schema, _ any) (any, error)

Deserialize decodes one datum, rejecting trailing bytes and unsafe long values. Schema registry metadata does not change Avro decoding in the pinned reference.

Example
package main

import (
	"context"
	"fmt"

	"github.com/rambow-cloud/powertools-lambda-go/kafka/avro"
)

func main() {
	// Avro encodes the string length as a zigzag integer before its UTF-8 bytes.
	value, err := avro.Deserialize(context.Background(), "CmhlbGxv", `"string"`, nil)
	fmt.Println(value, err)
}
Output:
hello <nil>

func New

func New(schema string) *kafka.FieldConfig

New configures an Avro field. Schema parsing remains lazy, as in the reference. The returned configuration can be supplied as either the Kafka key or value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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