avro

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

*

Index

Constants

View Source
const (
	AvroPrimitiveType_Null    = "null"
	AvroPrimitiveType_Boolean = "boolean"
	AvroPrimitiveType_Int     = "int"
	AvroPrimitiveType_Long    = "long"
	AvroPrimitiveType_Float   = "float"
	AvroPrimitiveType_Double  = "double"
	AvroPrimitiveType_Bytes   = "bytes"
	AvroPrimitiveType_String  = "string"

	AvroComplexType_Record = "record"
	AvroComplexType_Enums  = "enum"
	AvroComplexType_Array  = "array"
	AvroComplexType_Maps   = "map"
	AvroComplexType_Fixed  = "fixed"

	AvroLogicalType_Decimal         = "decimal"
	AvroLogicalType_Date            = "date"
	AvroLogicalType_TimeMillis      = "time-millis"
	AvroLogicalType_TimeMicros      = "time-micros"
	AvroLogicalType_TimestampMillis = "timestamp-millis"
	AvroLogicalType_TimestampMicros = "timestamp-micros"
	AvroLogicalType_Duration        = "duration"
)

Variables

View Source
var (
	ErrInvalidAvroSchema = fmt.Errorf("invalid avro schema because of unexpected data")
)

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	Type  string   `json:"type"` // MUST be "array"
	Items AvroType `json:"items"`
}

type AvroType

type AvroType struct {
	PrimitiveType *PrimitiveType
	RecordType    *RecordType
	EnumsType     *EnumsType
	ArrayType     *ArrayType
	MapsType      *MapsType
	UnionType     *UnionType
	FixedType     *FixedType
	LogicalType   *LogicalType
	DefinedType   *DefinedType
}

AvroType is an union type of Avro types

func (*AvroType) UnmarshalJSON

func (t *AvroType) UnmarshalJSON(b []byte) error

UnmarshalJSON gets actual Avro type(s) recursively.

type DefinedType

type DefinedType string // a type name already defined before

type EnumsType

type EnumsType struct {
	Type      string   `json:"type"` // MUST be "enum"
	Name      string   `json:"name"`
	Namespace string   `json:"namespace"`
	Aliases   []string `json:"aliases"`
	Doc       string   `json:"doc"`
	Symbols   []string `json:"symbols"`
}

type FixedType

type FixedType struct {
	Type      string   `json:"type"` // MUST be "fixed"
	Name      string   `json:"name"`
	Namespace string   `json:"namespace"`
	Aliases   []string `json:"aliases"`
	Size      int64    `json:"size"`
}

type LogicalType

type LogicalType struct {
	Type        string `json:"type"` // MUST follow spec
	LogicalType string `json:"logicalType"`

	// Decimal logical type specific
	Scale     int64 `json:"scale"`
	Precision int64 `json:"precision"`
}

type MapsType

type MapsType struct {
	Type   string   `json:"type"` // MUST be "map"
	Values AvroType `json:"values"`
}

type PrimitiveType

type PrimitiveType string

func ToPrimitiveType

func ToPrimitiveType(v string) *PrimitiveType

type RecordField

type RecordField struct {
	Name    string   `json:"name"`
	Doc     string   `json:"doc"`
	Type    AvroType `json:"type"`
	Default string   `json:"default"`
	Order   string   `json:"order"`
	Aliases []string `json:"aliases"`
}

type RecordType

type RecordType struct {
	Type      string        `json:"type"` // MUST be "record"
	Name      string        `json:"name"`
	Namespace string        `json:"namespace"`
	Doc       string        `json:"doc"`
	Aliases   []string      `json:"aliases"`
	Fields    []RecordField `json:"fields"`
}

type UnionType

type UnionType []AvroType

Jump to

Keyboard shortcuts

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