fields¶
-
class
levelorm.fields.
BaseField
(key: bool = False)[source]¶ Bases:
object
every model must have exactly one
String
orBlob
withkey=True
which 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.BaseField
represents 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.BaseField
represents 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.BaseField
represents 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.BaseField
represents an
int
. stored as a signed 4-byte int-
struct
= <Struct object>¶
-
-
class
levelorm.fields.
Float
(key: bool = False)[source]¶ Bases:
levelorm.fields.BaseField
represents 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.BaseField
represents 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>¶
-