minos.aggregate.events.fields
Classes
| Field Diff class. | |
| Field Diff Container class. | |
| Incremental Field Diff class. | 
- class FieldDiff[source]
- 
Field Diff class. - value: minos.aggregate.events.fields.T
 - classmethod from_model_type(model_type, *args, **kwargs)[source]
- Build a new instance from model type. 
 - property avro_bytes: bytes
- Generate bytes representation of the current instance. - Returns
- A bytes object. 
 
 - property avro_data: dict[str, Any]
- Compute the avro data of the model. - Returns
- A dictionary object. 
 
 - avro_schema = [{'name': 'FieldDiff', 'namespace': 'minos.aggregate.events.fields.8943870a-a66a-4fa4-b369-2ed28f7cbe07', 'type': 'record', 'fields': []}]
 - property avro_str: str
- Generate bytes representation of the current instance. - Returns
- A bytes object. 
 
 - classname = 'minos.aggregate.events.fields.FieldDiff'
 - static decode_data(decoder, target, type_, **kwargs)
- Decode data with the given decoder. - Parameters
- decoder (DataDecoder) – The decoder instance. 
- target (Any) – The data to be decoded. 
- type – The data type. 
- kwargs – Additional named arguments. 
- type_ (ModelType) – 
 
- Returns
- A decoded instance. 
- Return type
 
 - static decode_schema(decoder, target, **kwargs)
- Decode schema with the given encoder. - Parameters
- decoder (SchemaDecoder) – The decoder instance. 
- target (Any) – The schema to be decoded. 
- kwargs – Additional named arguments. 
 
- Returns
- The decoded schema as a type. 
- Return type
 
 - static encode_data(encoder, target, **kwargs)
- Encode data with the given encoder. - Parameters
- encoder (DataEncoder) – The encoder instance. 
- target (Any) – An optional pre-encoded data. 
- kwargs – Additional named arguments. 
 
- Returns
- The encoded data of the instance. 
- Return type
 
 - static encode_schema(encoder, target, **kwargs)
- Encode schema with the given encoder. - Parameters
- encoder (SchemaEncoder) – The encoder instance. 
- target (Any) – An optional pre-encoded schema. 
- kwargs – Additional named arguments. 
 
- Returns
- The encoded schema of the instance. 
- Return type
 
 - property fields: dict[str, minos.common.model.fields.Field]
- Fields getter 
 - classmethod from_avro(schema, data)
- Build a new instance from the - avroschema and data.
 - classmethod from_avro_bytes(raw, batch_mode=False, **kwargs)
- Build a single instance or a sequence of instances from bytes. - Parameters
- Returns
- A single instance or a sequence of instances. 
- Return type
 
 - classmethod from_avro_str(raw, **kwargs)
- Build a single instance or a sequence of instances from bytes 
 - classmethod from_typed_dict(typed_dict, *args, **kwargs)
- Build a - Modelfrom a- TypeDictand- data.- Parameters
- typed_dict (TypedDict) – - TypeDictobject containing the DTO’s structure
- args – Positional arguments to be passed to the model constructor. 
- kwargs – Named arguments to be passed to the model constructor. 
 
- Returns
- A new - DataTransferObjectinstance.
- Return type
- T 
 
 - get(k[, d]) D[k] if k in D, else d. d defaults to None.
 - items() a set-like object providing a view on D's items
 - keys() a set-like object providing a view on D's keys
 - model_type
- alias of - FieldDiff
 - classmethod to_avro_bytes(models)
- Create a - bytesrepresentation of the given object instances.
 - classmethod to_avro_str(models)
- Build the avro string representation of the given object instances. 
 - type_hints = {}
 - type_hints_parameters = (~T,)
 - values() an object providing a view on D's values
 
- class IncrementalFieldDiff[source]
- 
Incremental Field Diff class. - action: minos.aggregate.actions.Action
 - property avro_bytes: bytes
- Generate bytes representation of the current instance. - Returns
- A bytes object. 
 
 - property avro_data: dict[str, Any]
- Compute the avro data of the model. - Returns
- A dictionary object. 
 
 - avro_schema = [{'name': 'IncrementalFieldDiff', 'namespace': 'minos.aggregate.events.fields.09baf089-3754-43df-a303-d31b639e230f', 'type': 'record', 'fields': []}]
 - property avro_str: str
- Generate bytes representation of the current instance. - Returns
- A bytes object. 
 
 - classname = 'minos.aggregate.events.fields.IncrementalFieldDiff'
 - static decode_data(decoder, target, type_, **kwargs)
- Decode data with the given decoder. - Parameters
- decoder (DataDecoder) – The decoder instance. 
- target (Any) – The data to be decoded. 
- type – The data type. 
- kwargs – Additional named arguments. 
- type_ (ModelType) – 
 
- Returns
- A decoded instance. 
- Return type
 
 - static decode_schema(decoder, target, **kwargs)
- Decode schema with the given encoder. - Parameters
- decoder (SchemaDecoder) – The decoder instance. 
- target (Any) – The schema to be decoded. 
- kwargs – Additional named arguments. 
 
- Returns
- The decoded schema as a type. 
- Return type
 
 - static encode_data(encoder, target, **kwargs)
- Encode data with the given encoder. - Parameters
- encoder (DataEncoder) – The encoder instance. 
- target (Any) – An optional pre-encoded data. 
- kwargs – Additional named arguments. 
 
- Returns
- The encoded data of the instance. 
- Return type
 
 - static encode_schema(encoder, target, **kwargs)
- Encode schema with the given encoder. - Parameters
- encoder (SchemaEncoder) – The encoder instance. 
- target (Any) – An optional pre-encoded schema. 
- kwargs – Additional named arguments. 
 
- Returns
- The encoded schema of the instance. 
- Return type
 
 - property fields: dict[str, minos.common.model.fields.Field]
- Fields getter 
 - classmethod from_avro(schema, data)
- Build a new instance from the - avroschema and data.
 - classmethod from_avro_bytes(raw, batch_mode=False, **kwargs)
- Build a single instance or a sequence of instances from bytes. - Parameters
- Returns
- A single instance or a sequence of instances. 
- Return type
 
 - classmethod from_avro_str(raw, **kwargs)
- Build a single instance or a sequence of instances from bytes 
 - classmethod from_model_type(model_type, *args, **kwargs)
- Build a new instance from model type. 
 - classmethod from_typed_dict(typed_dict, *args, **kwargs)
- Build a - Modelfrom a- TypeDictand- data.- Parameters
- typed_dict (TypedDict) – - TypeDictobject containing the DTO’s structure
- args – Positional arguments to be passed to the model constructor. 
- kwargs – Named arguments to be passed to the model constructor. 
 
- Returns
- A new - DataTransferObjectinstance.
- Return type
- T 
 
 - get(k[, d]) D[k] if k in D, else d. d defaults to None.
 - items() a set-like object providing a view on D's items
 - keys() a set-like object providing a view on D's keys
 - model_type
- alias of - IncrementalFieldDiff
 - classmethod to_avro_bytes(models)
- Create a - bytesrepresentation of the given object instances.
 - classmethod to_avro_str(models)
- Build the avro string representation of the given object instances. 
 - type_hints = {}
 - type_hints_parameters = (~T,)
 - values() an object providing a view on D's values
 - value: minos.aggregate.events.fields.T
 
- class FieldDiffContainer[source]
- Bases: - BucketModel- Field Diff Container class. - get_one(name, return_diff=True)[source]
- Get first field diff with given name. 
 - get_all(return_diff=True)[source]
- Get a dictionary containing all names as keys and all the values of each one as values. - Parameters
- return_diff (bool) – If - Truethe result is returned as field diff instances, otherwise the result is returned as value instances.
- Returns
- A - dictwith- strkeys and- list[Any]values.
- Return type
- dict[str, Union[minos.aggregate.events.fields.FieldDiff, Any, list[minos.aggregate.events.fields.FieldDiff], list[Any]]] 
 
 - flatten_items()[source]
- Get the field differences in a flatten way. - Returns
- An - Iteratorof- tuple[str, FieldDiff]instances.
- Return type
- Iterator[tuple[str, minos.aggregate.events.fields.FieldDiff]] 
 
 - classmethod from_difference(a, b, ignore=frozenset({}))[source]
- Build a new instance from the difference between two models. - Parameters
- Returns
- A new - FieldDiffContainerinstance.
- Return type
 
 - classmethod from_model(model, ignore=frozenset({}))[source]
- Build a new difference from a single model. - Parameters
- Returns
- A new - FieldDiffContainerinstance.
- Return type
 
 - static generate_random_str()[source]
- Generate a random string - Returns
- A random string value. 
- Return type
 
 - property avro_bytes: bytes
- Generate bytes representation of the current instance. - Returns
- A bytes object. 
 
 - property avro_data: dict[str, Any]
- Compute the avro data of the model. - Returns
- A dictionary object. 
 
 - avro_schema = [{'name': 'FieldDiffContainer', 'namespace': 'minos.aggregate.events.fields.2d66bd5b-a1f2-4422-9cf2-cc581595e915', 'type': 'record', 'fields': []}]
 - property avro_str: str
- Generate bytes representation of the current instance. - Returns
- A bytes object. 
 
 - classname = 'minos.aggregate.events.fields.FieldDiffContainer'
 - static decode_data(decoder, target, type_, **kwargs)
- Decode data with the given decoder. - Parameters
- decoder (DataDecoder) – The decoder instance. 
- target (Any) – The data to be decoded. 
- type – The data type. 
- kwargs – Additional named arguments. 
- type_ (ModelType) – 
 
- Returns
- A decoded instance. 
- Return type
 
 - static decode_schema(decoder, target, **kwargs)
- Decode schema with the given encoder. - Parameters
- decoder (SchemaDecoder) – The decoder instance. 
- target (Any) – The schema to be decoded. 
- kwargs – Additional named arguments. 
 
- Returns
- The decoded schema as a type. 
- Return type
 
 - classmethod empty()
- Build an empty - BucketModelinstance.- Returns
- A - BucketModelinstance.
- Return type
- T 
 
 - static encode_data(encoder, target, **kwargs)
- Encode data with the given encoder. - Parameters
- encoder (DataEncoder) – The encoder instance. 
- target (Any) – An optional pre-encoded data. 
- kwargs – Additional named arguments. 
 
- Returns
- The encoded data of the instance. 
- Return type
 
 - static encode_schema(encoder, target, **kwargs)
- Encode schema with the given encoder. - Parameters
- encoder (SchemaEncoder) – The encoder instance. 
- target (Any) – An optional pre-encoded schema. 
- kwargs – Additional named arguments. 
 
- Returns
- The encoded schema of the instance. 
- Return type
 
 - property fields: dict[str, minos.common.model.fields.Field]
- Fields getter 
 - classmethod from_avro(schema, data)
- Build a new instance from the - avroschema and data.
 - classmethod from_avro_bytes(raw, batch_mode=False, **kwargs)
- Build a single instance or a sequence of instances from bytes. - Parameters
- Returns
- A single instance or a sequence of instances. 
- Return type
 
 - classmethod from_avro_str(raw, **kwargs)
- Build a single instance or a sequence of instances from bytes 
 - classmethod from_model_type(model_type, *args, **kwargs)
- Build a - DynamicModelfrom a- ModelType.- Parameters
- model_type (ModelType) – - ModelTypeobject containing the model structure
- args – Positional arguments to be passed to the model constructor. 
- kwargs – Named arguments to be passed to the model constructor. 
 
- Returns
- A new - DynamicModelinstance.
- Return type
- T 
 
 - classmethod from_typed_dict(typed_dict, *args, **kwargs)
- Build a - Modelfrom a- TypeDictand- data.- Parameters
- typed_dict (TypedDict) – - TypeDictobject containing the DTO’s structure
- args – Positional arguments to be passed to the model constructor. 
- kwargs – Named arguments to be passed to the model constructor. 
 
- Returns
- A new - DataTransferObjectinstance.
- Return type
- T 
 
 - get(k[, d]) D[k] if k in D, else d. d defaults to None.
 - items() a set-like object providing a view on D's items
 - keys() a set-like object providing a view on D's keys
 - model_type
- alias of - FieldDiffContainer
 - classmethod to_avro_bytes(models)
- Create a - bytesrepresentation of the given object instances.
 - classmethod to_avro_str(models)
- Build the avro string representation of the given object instances. 
 - type_hints = {}
 - type_hints_parameters = ()
 - values() an object providing a view on D's values