gen

package
v0.0.0-...-5105a15 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 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, gc 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, gc Config) error

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

Types

type Config

type Config struct {
	PackageName string
	Tags        map[string]TagStyle
}

Config exposes the options available for the code generation.

type TagStyle

type TagStyle string

TagStyle defines the styling for a tag.

const (
	// Snake is a style like im_written_in_snake_case.
	Snake TagStyle = "snake"
	// Camel is a style like imWrittenInCamelCase.
	Camel TagStyle = "camel"
	// Kebab is a style like im-written-in-kebab-case.
	Kebab TagStyle = "kebab"
	// UpperCamel is a style like ImWrittenInUpperCamel.
	UpperCamel TagStyle = "upper-camel"
)

Jump to

Keyboard shortcuts

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