Codec
- korus.database.backend.sqlite.codec.decode_datetime(v: str) datetime[source]
Decoder for datetime values.
- Args:
- v: str
The encoded datetime value. Must have the format %Y-%m-%d %H:%M:%S.%f
- Returns:
- : datetime
The decoded datetime object in UTC timezone. None, if the input string is None.
- korus.database.backend.sqlite.codec.decode_version(v: int) str[source]
Decode package version to a str.
- Args:
- : int
The encoded versio no.
- Returns:
- v: str
Version in the form x.y.z
- korus.database.backend.sqlite.codec.encode_field(value: Any, fcn: callable = None)[source]
Encode any input value.
If no encoding function is specified, the following default encoding rules are enforced,
tuples, lists, and dicts are encoded using json.dumps
datetime objects are encoded as strings using the format %Y-%m-%d %H:%M:%S.%f
type objects are encoded as strings using their class name
all other input types are returned unchanged
- Args:
- value: typing.Any
The value to be encoded
- fcn: callable (optional)
Encoding function.
- Returns:
- : typing.Any
The encoded value