Documentation
¶
Index ¶
- Variables
- func ParseYAML(data []byte) (string, error)
- func ResolveNamespaceAndName(subject, contents string) (string, string, error)
- func ResolveSubject(subject, contents string) (string, error)
- func WithOperation(field *AvroField)
- func WithOwner(field *AvroField)
- func WithPrimaryKeys(primaryKeys []string) func(field *AvroField)
- func WithSource(field *AvroField)
- func WithSubEnvironment(field *AvroField)
- func WithTimestamp(field *AvroField)
- func WithUUID(field *AvroField)
- type AvroField
- type AvroSchema
- type AvroTypeObject
- type AvroTypeWrapper
- type BasicAuthClient
- type JSON
- type LandoopRegistryClient
- func (c LandoopRegistryClient) GetAllSchemaVersions(subject string) ([]AvroSchema, error)
- func (c LandoopRegistryClient) GetSchemaBySubject(subject string, version int) (*AvroSchema, error)
- func (c LandoopRegistryClient) IsLatestSchemaCompatible(subject string, avroSchema string) (bool, error)
- func (c LandoopRegistryClient) IsSchemaRegistered(subject string, avroSchema string) (bool, error)
- func (c LandoopRegistryClient) IsSubjectNotFoundError(err error) bool
- func (c LandoopRegistryClient) RegisterNewSchema(subject string, avroSchema string) (int, error)
- func (c LandoopRegistryClient) Versions(subject string) ([]int, error)
- type NotifierClient
- type PubsubNotifierClient
- type RegistryClient
- type SchemaHeader
- type Validator
- type YAMLField
- type YAMLPayload
- type YAMLSchema
Constants ¶
This section is empty.
Variables ¶
var DefaultMetadataOptions = []func(field *AvroField){ WithUUID, WithTimestamp, WithSource, WithSubEnvironment, WithOwner, WithOperation, }
DefaultMetadataOptions contains the options required to build the default metadata
Functions ¶
func ResolveNamespaceAndName ¶
func ResolveSubject ¶
func WithOperation ¶
func WithOperation(field *AvroField)
func WithPrimaryKeys ¶
func WithSource ¶
func WithSource(field *AvroField)
func WithSubEnvironment ¶
func WithSubEnvironment(field *AvroField)
func WithTimestamp ¶
func WithTimestamp(field *AvroField)
Types ¶
type AvroField ¶
type AvroField struct { Name string `json:"name"` Doc string `json:"doc,omitempty"` Type AvroTypeWrapper `json:"type,omitempty"` Default interface{} `json:"default,omitempty"` }
AvroField is a field of an Avro Schema
func NewMetadata ¶
NewMetadata creates a new Metadata field with only the basic information filled
type AvroSchema ¶
type AvroSchema struct { Type string `json:"type"` Name string `json:"name"` Namespace string `json:"namespace"` Doc string `json:"doc"` Fields []AvroField `json:"fields,omitempty"` }
AvroSchema is the header for an Avro Schema
type AvroTypeObject ¶
type AvroTypeObject struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Doc string `json:"doc,omitempty"` LogicalType string `json:"logicalType,omitempty"` Symbols []string `json:"symbols,omitempty"` Fields []AvroField `json:"fields,omitempty"` Items string `json:"items,omitempty"` }
AvroTypeObject is the representation of a "type" field that is an object
type AvroTypeWrapper ¶
type AvroTypeWrapper struct { Type string `json:"-"` TypeList []*AvroTypeWrapper `json:"-"` TypeObj *AvroTypeObject `json:"-"` }
AvroTypeWrapper is a wrapper around the different Avro "type" field formats
func (AvroTypeWrapper) MarshalJSON ¶
func (j AvroTypeWrapper) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshaling routine to process each kind of Avro "type" field
func (*AvroTypeWrapper) UnmarshalJSON ¶
func (j *AvroTypeWrapper) UnmarshalJSON(data []byte) error
UnmarshalJSON tries to marshal to all possible "type"s and return an error if none matches
type BasicAuthClient ¶
type BasicAuthClient struct { Username string Password string // contains filtered or unexported fields }
func (BasicAuthClient) GetClient ¶
func (c BasicAuthClient) GetClient() *http.Client
type LandoopRegistryClient ¶
type LandoopRegistryClient struct {
// contains filtered or unexported fields
}
LandoopRegistryClient is the client for the Avro registry
func NewBasicAuthLandoopRegistryClient ¶
func NewBasicAuthLandoopRegistryClient(registryURL string, username string, password string) (LandoopRegistryClient, error)
NewBasicAuthLandoopRegistryClient returns a new registry client with basic authentication.
func (LandoopRegistryClient) GetAllSchemaVersions ¶
func (c LandoopRegistryClient) GetAllSchemaVersions(subject string) ([]AvroSchema, error)
GetAllSchemaVersions returns all schema versions of a given subject
func (LandoopRegistryClient) GetSchemaBySubject ¶
func (c LandoopRegistryClient) GetSchemaBySubject(subject string, version int) (*AvroSchema, error)
GetSchemaBySubject returns an AvroSchema for given subject and version
func (LandoopRegistryClient) IsLatestSchemaCompatible ¶
func (c LandoopRegistryClient) IsLatestSchemaCompatible(subject string, avroSchema string) (bool, error)
IsLatestSchemaCompatible tests compatibility with the latest version of a subject's schema.
func (LandoopRegistryClient) IsSchemaRegistered ¶
func (c LandoopRegistryClient) IsSchemaRegistered(subject string, avroSchema string) (bool, error)
IsSchemaRegistered checks if this exact schema has already been registered
func (LandoopRegistryClient) IsSubjectNotFoundError ¶
func (c LandoopRegistryClient) IsSubjectNotFoundError(err error) bool
IsSubjectNotFoundError checks the returned error to see if it is kind of a subject not found error code.
func (LandoopRegistryClient) RegisterNewSchema ¶
func (c LandoopRegistryClient) RegisterNewSchema(subject string, avroSchema string) (int, error)
RegisterNewSchema registers a schema. Returns a schema id (not to be confused with the schema version)
type NotifierClient ¶
type PubsubNotifierClient ¶
type PubsubNotifierClient struct {
// contains filtered or unexported fields
}
func NewPubsubNotifierClient ¶
func NewPubsubNotifierClient(projectID, topicName string) (PubsubNotifierClient, error)
func (PubsubNotifierClient) NotifySchemaChanged ¶
func (n PubsubNotifierClient) NotifySchemaChanged(namespace, name, source string) error
type RegistryClient ¶
type RegistryClient interface { RegisterNewSchema(subject, schema string) (int, error) IsSchemaRegistered(subject, schema string) (bool, error) IsLatestSchemaCompatible(subject, schema string) (bool, error) IsSubjectNotFoundError(err error) bool GetAllSchemaVersions(subject string) ([]AvroSchema, error) GetSchemaBySubject(subject string, version int) (*AvroSchema, error) Versions(subject string) ([]int, error) }
RegistryClient provides an interface to the Avro registry
type SchemaHeader ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator(client RegistryClient) *Validator
type YAMLField ¶
type YAMLField struct { Name string `yaml:"name"` Doc string `yaml:"doc"` Type interface{} `yaml:"type"` Required bool `yaml:"required"` }
YAMLField defines the field structure for unmarshal
type YAMLPayload ¶
YAMLPayload defines the payload structure for unmarshal
type YAMLSchema ¶
type YAMLSchema struct { Name string `yaml:"name"` Namespace string `yaml:"namespace"` Doc string `yaml:"doc"` PrimaryKeys []string `yaml:"primary_keys"` Payload YAMLPayload `yaml:"payload"` Fields []YAMLField `yaml:"fields"` }
YAMLSchema defines the document structure for unmarshal