Back to bricks list
Introduction
Technical Documentation
Other Classes
RField
Version

RField

RField, these fields must be used in resource attribute. When a class attribute is instantiated with an RField, it will be automatically save for output resource of a task and automatically initiated for input resource of a task

This field support a deserializer and serializer function to implement custom logic for saving and instantiating a resource

Attributes

include_in_dict_view: boolsearchable: bool

Functions

__INIT__

[summary]

               Only small amount of data can be mark as searchable, defaults to False
                 It is also possible to extend the RField class and override the deserialization method
                It is also possible to extend the RField class and override the serialization method
                  Support primitive value, Type of Callable function
                  If type or callable, it will be called without parameter to initialise the default value, defaults to None
                  Do not mark huge fields as include in dict view, defaults to False
Parameters:
NameTypeDefault valueDescription
searchablebool False If true, the field value is saved in the db and could be search on a request , optional
deserializerCallable Optional function that will be called manually deserialize the rfield value, defaults to none [[any], any], optional
serializerCallable Optional function that will be called to manually serialize the rfield value, defaults to none [[any], any], optional
default_valueUnion Default value of the resource attribute [type, callable[[], any], int, float, str, bool], optional
include_in_dict_viewbool False If true, this field we be included in the default dict view , optional
DESERIALIZE

Method to deserialize the r_field_value, can be overriden by a child class

Parameters:
NameTypeDefault valueDescription
r_field_valueAny Value of the r_field
Return type:
Any
GET_DEFAULT_VALUE
Return type:
Any
SERIALIZE

Method to serialize the r_field_value, can be overriden by a child class

Parameters:
NameTypeDefault valueDescription
r_field_valueAny Value of the r_field
Return type:
Any