protogen

package
v2.0.0-...-45b51b8 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gen allows generating Go structs from avro schemas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Struct

func Struct(s string, w io.Writer, cfg Config) error

Struct generates Go structs based on the schema and writes them to w.

func StructFromSchema

func StructFromSchema(schema avro.Schema, w io.Writer, cfg Config) error

StructFromSchema generates Go structs based on the schema and writes them to w.

Types

type Config

type Config struct {
	PackageName string
}

Config configures the code generation.

type Generator

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

Generator generates Go structs from schemas.

func NewGenerator

func NewGenerator(pkgName string, opts ...OptsFunc) *Generator

NewGenerator returns a generator.

func (*Generator) Parse

func (g *Generator) Parse(schema avro.Schema)

Parse parses an avro schema into Go types.

func (*Generator) Reset

func (g *Generator) Reset()

Reset reset the generator.

func (*Generator) Write

func (g *Generator) Write(w io.Writer) error

Write writes Go code from the parsed schemas.

type OptsFunc

type OptsFunc func(*Generator)

OptsFunc is a function that configures a generator.

Jump to

Keyboard shortcuts

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