avro-generator

command module
v0.0.0-...-25fd724 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2021 License: MIT Imports: 1 Imported by: 0

README

Avro schema from struct generator

This is an avro-schema from struct generator. It ignores functions, channels and other non supported kinds, and creates a avroschema using names from the json tags for your structure.

Usage

avro-generator [-o OUTPUT| -p PACKAGE] <typename>

This can be used together with gogen to generate avroschemas for structs. This usage requres go1.16

//go:generate go run github.com/ptcar2009/avro-generator ExportedStruct
type ExportedStruct struct {
    Field int `json:"field"`
    OtherField struct {
        Enum int
    }
}

Field nomeclature

Fields are named by the json tag value of the struct, or falls back to the struct name.

Type translation

go native type avro type
struct record
int int
float32 float
float64 double
pointer types type union between the underlying type and null
array array
slice array
char string
rune string

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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