Version: v2.0.1 Latest Latest

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

Go to latest
Published: Jan 15, 2017 License: MIT Imports: 9 Imported by: 2




View Source
const UTIL_FILE = "primitive.go"


This section is empty.


func DeserializeRecordSchema

func DeserializeRecordSchema(packageName string, schemaJson []byte, pkg *Package) error

Deserialize the JSON definiton of a record and generate structs, deserializer and serializer methods. This function only supports JSON maps at the moment, where "type" -> "record". Avro also allows for schemas which are JSON arrays or JSON strings, but we don't currently support those as the root JSON type.


type File

type File struct {
	// contains filtered or unexported fields

Represents a Go source file in the output package

func NewFile

func NewFile(name string) *File

func (*File) Functions

func (f *File) Functions() []FunctionName

func (*File) Imports

func (f *File) Imports() []string

func (*File) Structs

func (f *File) Structs() []string

type FunctionName

type FunctionName struct {
	// contains filtered or unexported fields

type FunctionNameList

type FunctionNameList []FunctionName

Implement the Sortable interface for FunctionNames

func (FunctionNameList) Len

func (f FunctionNameList) Len() int

func (FunctionNameList) Less

func (f FunctionNameList) Less(i, j int) bool

Sort functions by the struct to which they're attached first, then the name of the method itself. If the function isn't attached to a struct, put it at the bottom

func (FunctionNameList) Swap

func (f FunctionNameList) Swap(i, j int)

type Package

type Package struct {
	// contains filtered or unexported fields

Represents the output package

func NewPackage

func NewPackage(name string) *Package

func (*Package) File

func (p *Package) File(name string) (*File, bool)

func (*Package) Files

func (p *Package) Files() []string

func (*Package) WriteFiles

func (p *Package) WriteFiles(targetDir string) error

type RequiredMapKeyError

type RequiredMapKeyError struct {
	Key string

func NewRequiredMapKeyError

func NewRequiredMapKeyError(key string) *RequiredMapKeyError

func (*RequiredMapKeyError) Error

func (r *RequiredMapKeyError) Error() string

type SchemaError

type SchemaError struct {
	FieldName   string
	NestedError error

func NewSchemaError

func NewSchemaError(fieldName string, err error) *SchemaError

func (*SchemaError) Error

func (s *SchemaError) Error() string

type WrongMapValueTypeError

type WrongMapValueTypeError struct {
	Key          string
	ExpectedType string
	ActualValue  interface{}

func NewWrongMapValueTypeError

func NewWrongMapValueTypeError(key, expectedType string, actualValue interface{}) *WrongMapValueTypeError

func (*WrongMapValueTypeError) Error

func (w *WrongMapValueTypeError) Error() string

Jump to

Keyboard shortcuts

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