Skip to main content

DDD Value Objects implementation

Project description

Info:

DDD Value Object implementation.

Author:

Paweł Zadrożny @pawelzny <pawel.zny@gmail.com>

CI Status Documentation Status PyPI Repository Status Release Status Project Status Supported python versions License

Features

  • Value object can’t be changed once created

  • Two objects with the same values are considered equal

  • Access to values after dot: value.my_value

  • Access to values like dict: value[‘my_value’]

Installation

pip install vo

Package: https://pypi.org/project/vo/

Documentation

Read full documentation on: http://vo.readthedocs.io

Quick Example

>>> from vo import Value
>>> value = Value(test=True, some_text="I am some text string")
>>> value == value
True

>>> value_clone = Value(some_text="I am some text string", test=True)
>>> value == value_clone
True

>>> value is value_clone
False

>>> value_truth = Value(purpose_of_life=42)
>>> value == value_truth
False

>>> value_truth.purpose_of_life
42
>>> value_truth['purpose_of_life']
42

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

vo-0.3.0.tar.gz (24.0 kB view hashes)

Uploaded Source

Built Distribution

vo-0.3.0-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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