avros

package
v2.1.1-0...-182a82a Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvroTypes = map[types.Type]string{
	types.Message: "record",
	types.Bool:    "boolean",
	types.Int32:   "int",
	types.Int64:   "int",
	types.Float:   "float",
	types.Double:  "double",
	types.Bytes:   "bytes",
	types.String:  "string",
	types.Enum:    "enum",
	types.Array:   "array",
}

AvroTypes is a lookup table for avro descriptor types

View Source
var Types = map[string]types.Type{
	"record":  types.Message,
	"boolean": types.Bool,
	"int":     types.Int64,
	"float":   types.Float,
	"double":  types.Double,
	"bytes":   types.Bytes,
	"string":  types.String,
	"enum":    types.Enum,
	"array":   types.Array,
}

Types is a lookup table for avro descriptor types

Functions

func NewMessage

func NewMessage(path string, message *AvroSchema) *specs.Property

NewMessage constructs a schema Property with the given avro schema

func NewProperty

func NewProperty(path string, message *AvroSchema) *specs.Property

NewProperty constructs a schema Property with the given avro schema

func NewSchema

func NewSchema(descriptors []*AvroSchema) specs.Schemas

NewSchema constructs a new schema manifest from the given avro schema

func SchemaResolver

func SchemaResolver(imports []string, path string) providers.SchemaResolver

SchemaResolver returns a new schema resolver for the given avro collection

Types

type AvroSchema

type AvroSchema struct {
	Type      string        `json:"type"`
	Name      string        `json:"name"`
	Namespace string        `json:"namespace"`
	Symbols   []string      `json:"symbols"`
	Fields    []*AvroSchema `json:"fields"`
}

AvroSchema impliments avro high level schema

func Collect

func Collect(ctx *broker.Context, paths []string, path string) ([]*AvroSchema, error)

Collect attempts to collect all the available avro files inside the given path and parses them to resources

func UnmarshalFiles

func UnmarshalFiles(imports []string, files []*providers.FileInfo) ([]*AvroSchema, error)

UnmarshalFiles attempts to parse the given HCL files to intermediate resources. Files are parsed based from the given import paths

Jump to

Keyboard shortcuts

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