Documentation ¶
Index ¶
- Variables
- func GetNamespace(fullName string) string
- func GetNestedRecordSchemaFromDescriptor(fd *genDescriptor.FileDescriptorProto, md *genDescriptor.DescriptorProto, ...) ([]interface{}, error)
- func GetRecordSchemaFieldFromDescriptor(d *genDescriptor.FieldDescriptorProto, fd *genDescriptor.FileDescriptorProto, ...) (map[string]interface{}, error)
- func GetRecordSchemaFromDescriptor(fd *genDescriptor.FileDescriptorProto, md *genDescriptor.DescriptorProto, ...) (map[string]interface{}, error)
- func GetRecordSchemaFromMessage(msg descriptor.Message) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // mapping proto type to avro primitive type ProtoType2AvroType = map[descriptor.FieldDescriptorProto_Type]string{ descriptor.FieldDescriptorProto_TYPE_DOUBLE: "double", descriptor.FieldDescriptorProto_TYPE_FLOAT: "float", descriptor.FieldDescriptorProto_TYPE_INT64: "long", descriptor.FieldDescriptorProto_TYPE_UINT64: "long", descriptor.FieldDescriptorProto_TYPE_INT32: "int", descriptor.FieldDescriptorProto_TYPE_FIXED64: "long", descriptor.FieldDescriptorProto_TYPE_FIXED32: "int", descriptor.FieldDescriptorProto_TYPE_BOOL: "boolean", descriptor.FieldDescriptorProto_TYPE_STRING: "string", descriptor.FieldDescriptorProto_TYPE_BYTES: "bytes", descriptor.FieldDescriptorProto_TYPE_UINT32: "int", descriptor.FieldDescriptorProto_TYPE_SFIXED32: "int", descriptor.FieldDescriptorProto_TYPE_SFIXED64: "long", descriptor.FieldDescriptorProto_TYPE_SINT32: "int", descriptor.FieldDescriptorProto_TYPE_SINT64: "long", } // mapping proto type to avro zero-value to use it as default ProtoType2AvroDefault = map[descriptor.FieldDescriptorProto_Type]interface{}{ descriptor.FieldDescriptorProto_TYPE_DOUBLE: 0, descriptor.FieldDescriptorProto_TYPE_FLOAT: 0, descriptor.FieldDescriptorProto_TYPE_INT64: 0, descriptor.FieldDescriptorProto_TYPE_UINT64: 0, descriptor.FieldDescriptorProto_TYPE_INT32: 0, descriptor.FieldDescriptorProto_TYPE_FIXED64: 0, descriptor.FieldDescriptorProto_TYPE_FIXED32: 0, descriptor.FieldDescriptorProto_TYPE_BOOL: false, descriptor.FieldDescriptorProto_TYPE_STRING: "", descriptor.FieldDescriptorProto_TYPE_MESSAGE: nil, descriptor.FieldDescriptorProto_TYPE_BYTES: []byte{}, descriptor.FieldDescriptorProto_TYPE_UINT32: 0, descriptor.FieldDescriptorProto_TYPE_SFIXED32: 0, descriptor.FieldDescriptorProto_TYPE_SFIXED64: 0, descriptor.FieldDescriptorProto_TYPE_SINT32: 0, descriptor.FieldDescriptorProto_TYPE_SINT64: 0, } )
View Source
var (
ErrUnknownProtoType = fmt.Errorf("The protobuf type is unknown")
)
Functions ¶
func GetNamespace ¶
GetNamespace gets 'namespace' field in Avro from proto message name.
func GetNestedRecordSchemaFromDescriptor ¶
func GetNestedRecordSchemaFromDescriptor(fd *genDescriptor.FileDescriptorProto, md *genDescriptor.DescriptorProto, ns string) ([]interface{}, error)
func GetRecordSchemaFieldFromDescriptor ¶
func GetRecordSchemaFieldFromDescriptor(d *genDescriptor.FieldDescriptorProto, fd *genDescriptor.FileDescriptorProto, tm typeMap) (map[string]interface{}, error)
func GetRecordSchemaFromDescriptor ¶
func GetRecordSchemaFromDescriptor(fd *genDescriptor.FileDescriptorProto, md *genDescriptor.DescriptorProto, ns string) (map[string]interface{}, error)
func GetRecordSchemaFromMessage ¶
func GetRecordSchemaFromMessage(msg descriptor.Message) (map[string]interface{}, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.