fields¶
-
class
levelorm.fields.BaseField(key: bool = False)[source]¶ Bases:
objectevery model must have exactly one
StringorBlobwithkey=Truewhich will not be included in the value and instead used as the key
-
class
levelorm.fields.String(encoding: str = 'utf-8', key=False)[source]¶ Bases:
levelorm.fields.BaseFieldrepresents a
str. stored as an unsigned 4-byte length and encoded bytes-
length_struct= <Struct object>¶
-
-
class
levelorm.fields.Blob(key: bool = False)[source]¶ Bases:
levelorm.fields.BaseFieldrepresents a
bytes. stored as an unsigned 4-byte length and bytes-
length_struct= <Struct object>¶
-
-
class
levelorm.fields.Boolean(key: bool = False)[source]¶ Bases:
levelorm.fields.BaseFieldrepresents a
bool. stored as 1 byte (butlevelorm.orm.BaseModel.save()will pad to 4)-
struct= <Struct object>¶
-
-
class
levelorm.fields.Integer(key: bool = False)[source]¶ Bases:
levelorm.fields.BaseFieldrepresents an
int. stored as a signed 4-byte int-
struct= <Struct object>¶
-
-
class
levelorm.fields.Float(key: bool = False)[source]¶ Bases:
levelorm.fields.BaseFieldrepresents a
float. stored as a double precision (8 byte, binary64) float-
struct= <Struct object>¶
-
-
class
levelorm.fields.Array(inner: levelorm.fields.BaseField, key=False)[source]¶ Bases:
levelorm.fields.BaseFieldrepresents a
list. stored as an unsigned 4-byte length and however the inner class is serializedusage example:
class Matrices(DBBaseModel): prefix = 'matrix' name = String(key=True) numbers = Array(Array(Integer())) identity = Matrices('identity', [[1, 0], [0, 1]])
-
length_struct= <Struct object>¶
-