lib/rimless/avro_helpers.rb
# A shortcut to encode data using the specified schema to the Apache Avro
# format. This also applies data sanitation to avoid issues with the low
# level Apache Avro library (symbolized keys, etc) and it allows
# deep-relative schema names. When you pass +.deep.deep+ for example
# (leading period) it will prefix the schema name with the local
# namespace (so it becomes absolute).
#
# @param data [Mixed] the data structure to encode
# @param schema [String, Symbol] name of the schema that should be used
# @param opts [Hash{Symbol => Mixed}] additional options
# @return [String] the Apache Avro blob
A shortcut to encode data using the specified schema to the Apache Avro
format. This also applies data sanitation to avoid issues with the low
level Apache Avro library (symbolized keys, etc) and it allows
deep-relative schema names. When you pass +.deep.deep+ for example
(leading period) it will prefix the schema name with the local
namespace (so it becomes absolute).
A shortcut to encode data using the specified schema to the Apache Avro format . This also applies data sanitation to avoid issues with the low level Apache Avro library ( symbolized keys etc ) and it allows deep - relative schema names . When you pass + . deep . deep + for example ( leading period ) it will prefix the schema name with the local namespace ( so it becomes absolute ) .
def avro_encode(data, schema:, **opts)
        data = avro_sanitize(data)
        schema = avro_utils.namespace + schema.to_s \
          if schema.to_s.start_with? '.'
        avro.encode(data, schema_name: schema.to_s, **opts)
      end
def avro_encode ( data , schema : , ** opts ) data = avro_sanitize ( data ) schema = avro_utils . namespace + schema . to_s if schema . to_s . start_with? '.' avro . encode ( data , schema_name : schema . to_s , ** opts ) end
A shortcut to encode data using the specified schema to the Apache Avro
format.
A shortcut to encode data using the specified schema to the Apache Avro format .
# When the deep-relative form (+.deep.deep[..]+) is present, we add our # local namespace, so Avro can resolve it
the Apache Avro blob
the Apache Avro blob
String
data
the data structure to encode
the data structure to encode
schema
name of the schema that should be used
name of the schema that should be used
opts
None