Module: Avromatic::Model
- Defined in:
- lib/avromatic/model.rb,
lib/avromatic/model/builder.rb,
lib/avromatic/model/attributes.rb,
lib/avromatic/model/validation.rb,
lib/avromatic/model/configurable.rb,
lib/avromatic/model/field_helper.rb,
lib/avromatic/model/value_object.rb,
lib/avromatic/model/configuration.rb,
lib/avromatic/model/nested_models.rb,
lib/avromatic/model/coercion_error.rb,
lib/avromatic/model/types/map_type.rb,
lib/avromatic/model/message_decoder.rb,
lib/avromatic/model/types/date_type.rb,
lib/avromatic/model/types/enum_type.rb,
lib/avromatic/model/types/null_type.rb,
lib/avromatic/model/types/array_type.rb,
lib/avromatic/model/types/fixed_type.rb,
lib/avromatic/model/types/float_type.rb,
lib/avromatic/model/types/union_type.rb,
lib/avromatic/model/validation_error.rb,
lib/avromatic/model/raw_serialization.rb,
lib/avromatic/model/types/custom_type.rb,
lib/avromatic/model/types/record_type.rb,
lib/avromatic/model/types/string_type.rb,
lib/avromatic/model/types/big_int_type.rb,
lib/avromatic/model/types/boolean_type.rb,
lib/avromatic/model/types/decimal_type.rb,
lib/avromatic/model/types/integer_type.rb,
lib/avromatic/model/types/type_factory.rb,
lib/avromatic/model/types/abstract_type.rb,
lib/avromatic/model/custom_type_registry.rb,
lib/avromatic/model/messaging_serialization.rb,
lib/avromatic/model/unknown_attribute_error.rb,
lib/avromatic/model/custom_type_configuration.rb,
lib/avromatic/model/types/timestamp_micros_type.rb,
lib/avromatic/model/types/timestamp_millis_type.rb,
lib/avromatic/model/types/abstract_timestamp_type.rb
Defined Under Namespace
Modules: Attributes, Configurable, FieldHelper, MessagingSerialization, NestedModels, RawSerialization, Types, Validation, ValueObject Classes: Builder, CoercionError, Configuration, CustomTypeConfiguration, CustomTypeRegistry, MessageDecoder, UnknownAttributeError, ValidationError
Class Method Summary collapse
-
.build(**options) ⇒ Object
Returns a module that can be included in a class to define a model based on Avro schema(s).
-
.model(**options) ⇒ Object
Returns an anonymous class, that can be assigned to a constant, defined based on Avro schema(s).
Class Method Details
.build(**options) ⇒ Object
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.
45 46 47 |
# File 'lib/avromatic/model.rb', line 45 def self.build(**) Builder.new(**).mod end |