PrimitiveRField
Base class for Resource fields storing primitive Python types.
PrimitiveRField provides validation and storage for primitive values (int, float, str, bool). This class should not be used directly - use the specific subclasses (IntRField, FloatRField, StrRField, BoolRField) instead.
The field automatically: - Validates values using type-specific validators - Handles serialization/deserialization - Supports configurable storage backends (DATABASE, KV_STORE, NONE) - Includes values in dict views by default (configurable)
Each primitive type has its own validator that ensures type safety during both serialization and deserialization operations.
Attributes: validator: Type-specific validator for ensuring data integrity
Note: Use the specific subclasses (IntRField, FloatRField, etc.) rather than instantiating this class directly.
include_in_dict_view: boolstorage: RFieldStoragevalidator: ValidatorInitialize a PrimitiveRField with validation and storage configuration.
ValidatorAnybool - TrueRFieldStorage - RFieldStorage.KV_STOREDeserialize and validate a value from storage.
Validates the stored value using the field's validator before returning it.
AnyAnyGet the default value for this field.
If the default value is a Type or Callable, it will be called to generate a new default value. Otherwise, the default value is returned directly.
This ensures that mutable defaults (like lists or dicts) are not shared between Resource instances.
AnySerialize and validate a value for storage.
Validates the value using the field's validator before storing it.
AnyAny