A collection of Value Objects to save time by generalizing data type and format validations.
Project description
Python Value-Objects
A collection of Value Objects to save time by generalizing types and format validations.
Value-objects
Numeric value-objects
Int
Integer numbers without a fractional component that don't support decimal points.
from pyvalueobjects import Int
# Creation
my_integer = Int(9)
# Getting raw value
my_integer.value() # returns -> 9
Nullable Int
Integer numbers and None.
from pyvalueobjects import NullableInt
# Creation
my_integer = NullableInt(9)
# Creating from None
my_nullable_integer = NullableInt(None)
# Getting raw value
my_integer.value() # returns -> 9
my_nullable_integer.value() # returns -> None
String value-objects
String
from pyvalueobjects import String
# Creation
my_str = String('potato')
# Getting raw value
my_str.value() # returns -> 'potato'
Nullable String
from pyvalueobjects import NullableString
# Creation
my_str = NullableString('potato')
# Getting raw value
my_str.value() # returns -> 'potato'
# Creation
my_nullable_str = NullableString(None)
# Getting raw value
my_nullable_str.value() # returns -> None
Uuid4
from pyvalueobjects import Uuid4
# Creation
my_uuid4 = Uuid4('6c7add12-bf35-459e-a6c5-3178a2a33011')
# Getting raw value
my_uuid4.value() # returns -> '6c7add12-bf35-459e-a6c5-3178a2a33011'
Nullable Uuid4
from pyvalueobjects import NullableUuid4
# Creation
my_uuid4 = NullableUuid4('6c7add12-bf35-459e-a6c5-3178a2a33011')
my_null_uuid4 = NullableUuid4(None)
# Getting raw value
my_uuid4.value() # returns -> '6c7add12-bf35-459e-a6c5-3178a2a33011'
my_null_uuid4.value() # returns -> 'None'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyvalueobjects-0.18.2.tar.gz
(6.3 kB
view hashes)
Built Distribution
Close
Hashes for pyvalueobjects-0.18.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8ffeb95b15e0d09f1e7043f21aad381be9fd6445e45825ddc44ba91c4b3776b |
|
MD5 | 104963640d7d8a3aebeb92fff89e8d28 |
|
BLAKE2b-256 | 94bf6449671ae7a92187e3d804f7aa1e36fe12785d75558dd9ddbb5f8a21ca3b |