Simple-entity
Simeple Entity Type for DDD development.
Install
pip install -U simple-entity
Use
class Activity(Entity):
title: str = "activity"
timeCreate: datetime = None
timeStart: datetime = None
timeEnd: datetime = None
timeEdit: datetime = None
def update(self, fields: List[str]):
self.timeEdit = datetime.now()
return
activity = Activity(
_id="0",
title="act0",
timeCreate=datetime(2020, 1, 1),
timeStart=datetime(2020, 1, 1),
timeEnd=datetime(2020, 1, 10),
)
act_dict = {
"_id": "0",
"timeCreate": datetime(2020, 1, 1, 0, 0),
"timeStart": datetime(2020, 1, 1, 0, 0),
"timeEdit": None,
"timeEnd": datetime(2020, 1, 10, 0, 0),
"title": "act0",
}
assert activity.to_dict() == act_dict
assert Activity.from_dict(act_dict) == activity
Metadata
Release files for simple-entity 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple-entity-0.1.1.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_entity-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / simple-entity-0.1.1.tar.gz
| Download URL | simple-entity-0.1.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8af8ae95f959b01dea3ed2516d236c459d23f7c11b037505eda6702428432f09
|
|
BLAKE2b-256 checksum How to use checksums |
4609293570a177c984e631e79edf7618f86e66127a3390ca3d7037e7995cf033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.3 CPython/3.8.6 Linux/5.4.0-1026-azure
|
Release files / simple_entity-0.1.1-py3-none-any.whl
| Download URL | simple_entity-0.1.1-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
472109e2c52ad941c7c81b1e391ad397e46f5088fb84abd2c79b23343eef5619
|
|
BLAKE2b-256 checksum How to use checksums |
c7d49c28ddf0cd8427cf26031a0e19be3537810a6f6e38c05fac7e234e778b74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.3 CPython/3.8.6 Linux/5.4.0-1026-azure
|