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 ¶
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.