Module pyfreedb.row.models
Classes
class BoolField (column_name: str = '')
-
A field for storing boolean values.
Expand source code
def __get__(self, obj: Any, _: Any) -> Optional[T]: value = getattr(obj._data, self._field_name) return cast(Optional[T], value)
Ancestors
- pyfreedb.row.models._Field
- typing.Generic
class FloatField (column_name: str = '')
-
A field for storing floating point number values.
Expand source code
def __get__(self, obj: Any, _: Any) -> Optional[T]: value = getattr(obj._data, self._field_name) return cast(Optional[T], value)
Ancestors
- pyfreedb.row.models._NumberField
- pyfreedb.row.models._Field
- typing.Generic
class IntegerField (column_name: str = '')
-
A field for integer number values.
Expand source code
def __get__(self, obj: Any, _: Any) -> Optional[T]: value = getattr(obj._data, self._field_name) return cast(Optional[T], value)
Ancestors
- pyfreedb.row.models._NumberField
- pyfreedb.row.models._Field
- typing.Generic
class Model (*args: Any, **kwargs: Any)
-
Base class of model class to be used by GoogleSheetRowStore.
Client should not use this class directly, inherit this class to define your own model instead.
>>> class Person(Model): ... name = StringField() ... age = IntegerField()
Expand source code
class Model(metaclass=_Meta): """Base class of model class to be used by GoogleSheetRowStore. Client should not use this class directly, inherit this class to define your own model instead. >>> class Person(Model): ... name = StringField() ... age = IntegerField() """ _fields: Dict[str, Union[IntegerField, FloatField, BoolField, StringField]] def _validate_type(self) -> None: for field in self._fields: # Trigger the validation by reassigning the value to itself. setattr(self, field, getattr(self, field))
class NotSet
-
A dummy class to differentiate between fields that are not set and None.
>>> model_obj = store.select("name").excute()[0] >>> model_obj.name is NotSet False >>> model_obj.age is NotSet True
Expand source code
class NotSet: """A dummy class to differentiate between fields that are not set and None. >>> model_obj = store.select("name").excute()[0] >>> model_obj.name is NotSet False >>> model_obj.age is NotSet True """
class StringField (column_name: str = '')
-
A field for storing string values.
Expand source code
def __get__(self, obj: Any, _: Any) -> Optional[T]: value = getattr(obj._data, self._field_name) return cast(Optional[T], value)
Ancestors
- pyfreedb.row.models._Field
- typing.Generic