:py:mod:`core.bones.record` =========================== .. py:module:: core.bones.record Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: core.bones.record.RecordBone .. py:class:: RecordBone(*, format = None, indexed = False, using = None, **kwargs) Bases: :py:obj:`viur.core.bones.base.BaseBone` The RecordBone class is a specialized bone type used to store structured data. It inherits from the BaseBone class. The RecordBone class is designed to store complex data structures, such as nested dictionaries or objects, by using a related skeleton class (the using parameter) to manage the internal structure of the data. :param format: Optional string parameter to specify the format of the record bone. :param indexed: Optional boolean parameter to indicate if the record bone is indexed. Defaults to False. :param using: A class that inherits from 'viur.core.skeleton.RelSkel' to be used with the RecordBone. :param kwargs: Additional keyword arguments to be passed to the BaseBone constructor. Initializes a new Bone. .. py:attribute:: type :value: 'record' .. py:method:: singleValueUnserialize(val) Unserializes a single value, creating an instance of the 'using' class and unserializing the value into it. :param val: The value to unserialize. :return: An instance of the 'using' class with the unserialized data. :raises AssertionError: If the unserialized value is not a dictionary. .. py:method:: singleValueSerialize(value, skel, name, parentIndexed) Serializes a single value by calling the serialize method of the 'using' skeleton instance. :param value: The value to be serialized, which should be an instance of the 'using' skeleton. :param skel: The parent skeleton instance. :param name: The name of the bone. :param parentIndexed: A boolean indicating if the parent bone is indexed. :return: The serialized value. .. py:method:: _get_single_destinct_hash(value) Returns a distinct hash value for a single entry of this bone. The returned value must be hashable. .. py:method:: parseSubfieldsFromClient() Determines if the current request should attempt to parse subfields received from the client. This should only be set to True if a list of dictionaries is expected to be transmitted. .. py:method:: singleValueFromClient(value, skel, bone_name, client_data) Load a single value from a client :param value: The single value which should be loaded. :param skel: The SkeletonInstance where the value should be loaded into. :param bone_name: The bone name of this bone in the SkeletonInstance. :param client_data: The data taken from the client, a dictionary with usually bone names as key :return: A tuple. If the value is valid, the first element is the parsed value and the second is None. If the value is invalid or not parseable, the first element is a empty value and the second a list of *ReadFromClientError*. .. py:method:: getSearchTags(skel, name) Collects search tags from the 'using' skeleton instance for the given bone. :param skel: The parent skeleton instance. :param name: The name of the bone. :return: A set of search tags generated from the 'using' skeleton instance. .. py:method:: getSearchDocumentFields(valuesCache, name, prefix='') Generates a list of search document fields for the given values cache, name, and optional prefix. :param dict valuesCache: A dictionary containing the cached values. :param str name: The name of the bone to process. :param str prefix: An optional prefix to use for the search document fields, defaults to an empty string. :return: A list of search document fields. :rtype: list .. py:method:: getReferencedBlobs(skel, name) Retrieves a set of referenced blobs for the given skeleton instance and name. :param skel: The skeleton instance to process. :param name: The name of the bone to process. :return: A set of referenced blobs. .. py:method:: getUniquePropertyIndexValues(valuesCache, name) :abstractmethod: This method is intentionally not implemented as it's not possible to determine how to derive a key from the related skeleton being used (i.e., which fields to include and how). .. py:method:: structure() Describes the bone and its settings as an JSON-serializable dict. This function has to be implemented for subsequent, specialized bone types.