Skip to main content

Simeple Entity Type for DDD development.

Project description

Simple-entity

CI 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-entity-0.1.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

simple_entity-0.1.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file simple-entity-0.1.1.tar.gz.

File metadata

  • Download URL: simple-entity-0.1.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.3 CPython/3.8.6 Linux/5.4.0-1026-azure

File hashes

Hashes for simple-entity-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8af8ae95f959b01dea3ed2516d236c459d23f7c11b037505eda6702428432f09
MD5 db95dc14e14a9855e0d3ade33bcf3859
BLAKE2b-256 4609293570a177c984e631e79edf7618f86e66127a3390ca3d7037e7995cf033

See more details on using hashes here.

File details

Details for the file simple_entity-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: simple_entity-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.3 CPython/3.8.6 Linux/5.4.0-1026-azure

File hashes

Hashes for simple_entity-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 472109e2c52ad941c7c81b1e391ad397e46f5088fb84abd2c79b23343eef5619
MD5 6a485d576c4b2ffcfc7dd829033f9a00
BLAKE2b-256 c7d49c28ddf0cd8427cf26031a0e19be3537810a6f6e38c05fac7e234e778b74

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page