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
Constants ¶
View Source
const AvroTypeRecord = "record"
View Source
const SubjectPostfixValue = "value"
Variables ¶
View Source
var AvroSchemaCache = map[string]AvroSchemaCacheObj{}
AvroSchemaCache is for creating a cache of schemas
View Source
var AvroSchemaRegistryCache = map[int]*srclient.Schema{}
View Source
var ErrNoRegistryHostDefined = errors.New("no registry host is defined")
View Source
var ErrSubjectNotFound = errors.New("404 Not Found: Subject in Schema Registry")
View Source
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
Click to show internal directories.
Click to hide internal directories.