From b3648ab225debfd9533b1b29fac70ab738281032 Mon Sep 17 00:00:00 2001 From: Javier Parada Date: Fri, 15 Dec 2023 09:29:13 +0900 Subject: [PATCH] update readme and exports --- README.md | 120 +++++++++++++++++++++++++++++++++++++ pyvalueobjects/__init__.py | 1 + 2 files changed, 121 insertions(+) diff --git a/README.md b/README.md index 34d17c3..bd48d43 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,14 @@ A collection of Value Objects to save time by generalizing types and format vali * [Numeric value-objects](#numeric-value-objects) * [Int](#int) * [Nullable Int](#nullable-int) + * [Positive Int](#positive-int) + * [Nullable Positive Int](#positive-int) + * [Positive or zero Int](#positive-or-zero-int) + * [Nullable Positive or zero Int](#nullable-positive-or-zero-int) + * [Negative Int](#negative-int) + * [Nullable Negative Int](#nullable-negative-int) + * [Negative or zero Int](#negative-or-zero-int) + * [Nullable Negative or zero Int](#nullable-negative-or-zero-int) * [String value-objects](#string-value-objects) * [String](#string) * [Nullable String](#nullable-string) @@ -70,6 +78,118 @@ my_integer.value() # returns -> 9 my_nullable_integer.value() # returns -> None ``` +### Positive Int + +```python +from pyvalueobjects import PositiveInt + +# Creation +my_integer = PositiveInt(9) + +# Getting raw value +my_integer.value() # returns -> 9 +``` + +### Nullable Positive Int + +```python +from pyvalueobjects import NullablePositiveInt + +# Creation +my_integer = NullablePositiveInt(9) + +# Creating from None +my_nullable_integer = NullablePositiveInt(None) + +# Getting raw value +my_integer.value() # returns -> 9 +my_nullable_integer.value() # returns -> None +``` + +### Positive Or Zero Int + +```python +from pyvalueobjects import PositiveOrZeroInt + +# Creation +my_integer = PositiveOrZeroInt(9) + +# Getting raw value +my_integer.value() # returns -> 9 +``` + +### Nullable Positive Or Zero Int + +```python +from pyvalueobjects import NullablePositiveOrZeroInt + +# Creation +my_integer = NullablePositiveOrZeroInt(9) + +# Creating from None +my_nullable_integer = NullablePositiveOrZeroInt(None) + +# Getting raw value +my_integer.value() # returns -> 9 +my_nullable_integer.value() # returns -> None +``` + +### Negative Int + +```python +from pyvalueobjects import NegativeInt + +# Creation +my_integer = NegativeInt(-9) + +# Getting raw value +my_integer.value() # returns -> -9 +``` + +### Nullable Negative Int + +```python +from pyvalueobjects import NullableNegativeInt + +# Creation +my_integer = NullableNegativeInt(-9) + +# Creating from None +my_nullable_integer = NullableNegativeInt(None) + +# Getting raw value +my_integer.value() # returns -> -9 +my_nullable_integer.value() # returns -> None +``` + +### Negative Or Zero Int + +```python +from pyvalueobjects import NegativeOrZeroInt + +# Creation +my_integer = NegativeOrZeroInt(-9) + +# Getting raw value +my_integer.value() # returns -> -9 +``` + +### Nullable Negative Or Zero Int + +```python +from pyvalueobjects import NullableNegativeOrZeroInt + +# Creation +my_integer = NullableNegativeOrZeroInt(-9) + +# Creating from None +my_nullable_integer = NullableNegativeOrZeroInt(None) + +# Getting raw value +my_integer.value() # returns -> -9 +my_nullable_integer.value() # returns -> None +``` + ## String value-objects ### String diff --git a/pyvalueobjects/__init__.py b/pyvalueobjects/__init__.py index b33f239..bf91c8f 100644 --- a/pyvalueobjects/__init__.py +++ b/pyvalueobjects/__init__.py @@ -17,6 +17,7 @@ from pyvalueobjects.numbers.nullable_negative_or_zero_int import NullableNegativeOrZeroInt from pyvalueobjects.numbers.nullable_positive_or_zero_int import NullablePositiveOrZeroInt from pyvalueobjects.numbers.positive_int import PositiveInt +from pyvalueobjects.numbers.nullable_positive_int import NullablePositiveInt from pyvalueobjects.numbers.positive_or_zero_int import PositiveOrZeroInt # -----------------------------