Sha256: f31101209bab4feeb01b20ea7081624654a64794d0e559423ea6a8709fcb9a48

Contents?: true

Size: 1.65 KB

Versions: 51

Compression:

Stored size: 1.65 KB

Contents

require 'avromatic/model/builder'
require 'avromatic/model/message_decoder'
require 'avromatic/model/type_registry'
require 'avromatic/model/logical_types'

module Avromatic
  module Model

    # Returns a module that can be included in a class to define a model
    # based on Avro schema(s).
    #
    # Example:
    #   class MyTopic
    #     include Avromatic::Model.build(schema_name: :topic_value,
    #                                      key_schema_name: :topic_key)
    #   end
    #
    # Either schema(_name) or value_schema(_name) must be specified.
    #
    # value_schema(_name) is handled identically to schema(_name) and is
    # treated like an alias for use when both a value and a key schema are
    # specified.
    #
    # Options:
    #   value_schema_name:
    #     The full name of an Avro schema. The schema will be loaded
    #     using the schema store.
    #   value_schema:
    #     An Avro::Schema.
    #   schema_name:
    #     The full name of an Avro schema. The schema will be loaded
    #     using the schema store.
    #   schema:
    #     An Avro::Schema.
    #   key_schema_name:
    #     The full name of an Avro schema for the key. When an instance of
    #     the model is encoded, this schema will be used to encode the key.
    #     The schema will be loaded using the schema store.
    #   key_schema:
    #     An Avro::Schema for the key.
    def self.build(**options)
      Builder.new(**options).mod
    end

    # Returns an anonymous class, that can be assigned to a constant,
    # defined based on Avro schema(s). See Avromatic::Model.build.
    def self.model(**options)
      Builder.model(**options)
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
avromatic-1.0.0 lib/avromatic/model.rb
avromatic-0.33.0 lib/avromatic/model.rb
avromatic-0.32.0 lib/avromatic/model.rb
avromatic-0.32.0.rc0 lib/avromatic/model.rb
avromatic-0.31.0 lib/avromatic/model.rb
avromatic-0.30.0 lib/avromatic/model.rb
avromatic-0.29.1 lib/avromatic/model.rb
avromatic-0.29.0 lib/avromatic/model.rb
avromatic-0.28.1 lib/avromatic/model.rb
avromatic-0.27.0 lib/avromatic/model.rb
avromatic-0.26.0 lib/avromatic/model.rb
avromatic-0.25.0 lib/avromatic/model.rb
avromatic-0.24.0 lib/avromatic/model.rb
avromatic-0.23.0 lib/avromatic/model.rb
avromatic-0.22.0 lib/avromatic/model.rb
avromatic-0.21.1 lib/avromatic/model.rb
avromatic-0.21.0 lib/avromatic/model.rb
avromatic-0.21.0.rc1 lib/avromatic/model.rb
avromatic-0.21.0.rc0 lib/avromatic/model.rb
avromatic-0.20.0 lib/avromatic/model.rb