Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyAvroEncoding(namespace string, encoded []byte, err error, name string, ...) ([]byte, error)
- func CreateSchemaForSubject(subject, namespace, name string, encoder sarama.Encoder) (*srclient.Schema, error)
- func EnsureAvroEncoded(namespace string, encoded []byte, err error, name string, ...) ([]byte, error)
- func EnsureEncoded(encoded []byte, err error, encoder sarama.Encoder) ([]byte, error)
- func GetAvroSchemaJson(namespace string, name string, data interface{}) (schemaJson []byte)
- func GetSchemaById(schemaId int) (*srclient.Schema, error)
- func GetSchemaBySubject(subject string) (*srclient.Schema, error)
- func MatchSchemaForSubject(subject, namespace, name string, existingSchema string, encoder sarama.Encoder) bool
- func SetCompatibilityForSubject(subject string) (bool, error)
- type AvroSchema
- type AvroSchemaCacheObj
- type AvroSchemaField
- type AvroSchemaMap
- type SchemaRegistryHost
- func (host *SchemaRegistryHost) ApplyAvroEncoding(namespace string, encoded []byte, err error, name string, ...) ([]byte, error)
- func (host *SchemaRegistryHost) CreateSchemaForSubject(subject, namespace, name string, encoder sarama.Encoder) (*srclient.Schema, error)
- func (host *SchemaRegistryHost) EnsureAvroEncoded(namespace string, encoded []byte, err error, name string, ...) ([]byte, error)
- func (host *SchemaRegistryHost) GenerateAvroSchema(namespace string, name string, data interface{}, values *reflect.Value) (schema AvroSchema)
- func (host *SchemaRegistryHost) GetAvroSchema(namespace string, name string, data interface{}) (schema AvroSchema)
- func (host *SchemaRegistryHost) GetAvroSchemaJson(namespace string, name string, data interface{}) (schemaJson []byte)
- func (host *SchemaRegistryHost) GetSchemaById(schemaId int) (*srclient.Schema, error)
- func (host *SchemaRegistryHost) GetSchemaBySubject(subject string) (*srclient.Schema, error)
- func (host *SchemaRegistryHost) Init(schemaHost string) error
- func (host *SchemaRegistryHost) MatchSchemaForSubject(subject, namespace, name string, existingSchema string, encoder sarama.Encoder) bool
- func (host *SchemaRegistryHost) SetCompatibilityForSubject(subject string) (bool, error)
Constants ¶
const AvroTypeRecord = "record"
const SubjectPostfixValue = "value"
Variables ¶
var AvroSchemaCache = map[string]AvroSchemaCacheObj{}
AvroSchemaCache is for creating a cache of schemas
var AvroSchemaRegistryCache = map[int]*srclient.Schema{}
var ErrNoRegistryHostDefined = errors.New("no registry host is defined")
var ErrSubjectNotFound = errors.New("404 Not Found: Subject in Schema Registry")
var RegistryHost = ""
Functions ¶
func ApplyAvroEncoding ¶
func ApplyAvroEncoding(namespace string, encoded []byte, err error, name string, encoder sarama.Encoder) ([]byte, error)
ApplyAvroEncoding uses the schema registry
func CreateSchemaForSubject ¶
func EnsureAvroEncoded ¶
func EnsureAvroEncoded(namespace string, encoded []byte, err error, name string, encoder sarama.Encoder) ([]byte, error)
EnsureAvroEncoded avro encodes the type
func EnsureEncoded ¶
EnsureEncoded json encodes the type
func GetAvroSchemaJson ¶
GetAvroSchemaJson scans struct to create avro schema json []byte
func MatchSchemaForSubject ¶
Types ¶
type AvroSchema ¶
type AvroSchema struct { Namespace string `json:"namespace"` Type string `json:"type"` Name string `json:"name"` Fields []AvroSchemaField `json:"fields"` }
AvroSchema is the schema for a struct type
func GenerateAvroSchema ¶
func GenerateAvroSchema(namespace string, name string, data interface{}, values *reflect.Value) (schema AvroSchema)
GenerateAvroSchema scans struct to create avro schema
func GetAvroSchema ¶
func GetAvroSchema(namespace string, name string, data interface{}) (schema AvroSchema)
type AvroSchemaCacheObj ¶
type AvroSchemaCacheObj struct { Json []byte Schema AvroSchema }
AvroSchemaCacheObj is a a single cache object that will store schema object and json
type AvroSchemaField ¶
type AvroSchemaField struct { Name string `json:"name"` Type interface{} `json:"type"` }
AvroSchemaField is a single field for the schema
type AvroSchemaMap ¶
type AvroSchemaMap struct { Type string `json:"type"` Values interface{} `json:"values"` }
AvroSchemaMap is a single map field for the schema
type SchemaRegistryHost ¶ added in v0.2.2
type SchemaRegistryHost struct { RegistryHost string AvroSchemaCache map[string]AvroSchemaCacheObj AvroSchemaRegistryCache map[int]*srclient.Schema }
func (*SchemaRegistryHost) ApplyAvroEncoding ¶ added in v0.2.2
func (host *SchemaRegistryHost) ApplyAvroEncoding(namespace string, encoded []byte, err error, name string, encoder sarama.Encoder) ([]byte, error)
ApplyAvroEncoding uses the schema registry
func (*SchemaRegistryHost) CreateSchemaForSubject ¶ added in v0.2.2
func (*SchemaRegistryHost) EnsureAvroEncoded ¶ added in v0.2.2
func (host *SchemaRegistryHost) EnsureAvroEncoded(namespace string, encoded []byte, err error, name string, encoder sarama.Encoder) ([]byte, error)
EnsureAvroEncoded avro encodes the type
func (*SchemaRegistryHost) GenerateAvroSchema ¶ added in v0.2.2
func (host *SchemaRegistryHost) GenerateAvroSchema(namespace string, name string, data interface{}, values *reflect.Value) (schema AvroSchema)
GenerateAvroSchema scans struct to create avro schema
func (*SchemaRegistryHost) GetAvroSchema ¶ added in v0.2.2
func (host *SchemaRegistryHost) GetAvroSchema(namespace string, name string, data interface{}) (schema AvroSchema)
func (*SchemaRegistryHost) GetAvroSchemaJson ¶ added in v0.2.2
func (host *SchemaRegistryHost) GetAvroSchemaJson(namespace string, name string, data interface{}) (schemaJson []byte)
GetAvroSchemaJson scans struct to create avro schema json []byte
func (*SchemaRegistryHost) GetSchemaById ¶ added in v0.2.2
func (host *SchemaRegistryHost) GetSchemaById(schemaId int) (*srclient.Schema, error)
func (*SchemaRegistryHost) GetSchemaBySubject ¶ added in v0.2.2
func (host *SchemaRegistryHost) GetSchemaBySubject(subject string) (*srclient.Schema, error)
func (*SchemaRegistryHost) Init ¶ added in v0.2.2
func (host *SchemaRegistryHost) Init(schemaHost string) error
func (*SchemaRegistryHost) MatchSchemaForSubject ¶ added in v0.2.2
func (*SchemaRegistryHost) SetCompatibilityForSubject ¶ added in v0.2.2
func (host *SchemaRegistryHost) SetCompatibilityForSubject(subject string) (bool, error)