From 0d151cb6e17ea1492b0dcec2aa168c67a93ceef8 Mon Sep 17 00:00:00 2001 From: Oxylibrium Date: Mon, 8 Jul 2019 08:43:15 +0530 Subject: [PATCH 1/2] BigInteger type --- src/ormantic/fields.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ormantic/fields.py b/src/ormantic/fields.py index 9665f48..1934eff 100644 --- a/src/ormantic/fields.py +++ b/src/ormantic/fields.py @@ -111,6 +111,27 @@ def Integer( ) return type("Integer", (pydantic.ConstrainedInt, ColumnFactory), namespace) +def BigInteger( + *, + primary_key: bool = False, + allow_null: bool = False, + index: bool = False, + unique: bool = False, + minimum: int = None, + maximum: int = None, + multiple_of: int = None, +) -> Type[int]: + namespace = dict( + primary_key=primary_key, + allow_null=allow_null, + index=index, + unique=unique, + ge=minimum, + le=maximum, + multiple_of=multiple_of, + column_type=sqlalchemy.BigInteger(), + ) + return type("BigInteger", (pydantic.ConstrainedInt, ColumnFactory), namespace) def Float( *, From 961bcfc878a90d5309c59447abe3098b59dd26ac Mon Sep 17 00:00:00 2001 From: Oxylibrium Date: Mon, 8 Jul 2019 18:19:34 +0530 Subject: [PATCH 2/2] Update __init__.py Add BigInteger type in the from import line. --- src/ormantic/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ormantic/__init__.py b/src/ormantic/__init__.py index 39788e3..4d2cc5e 100755 --- a/src/ormantic/__init__.py +++ b/src/ormantic/__init__.py @@ -1,6 +1,7 @@ from ormantic.exceptions import MultipleMatches, NoMatch from ormantic.fields import ( Boolean, + BigInteger, Date, DateTime, Enum, @@ -20,6 +21,7 @@ "NoMatch", "MultipleMatches", "Boolean", + "BigInteger", "Date", "Enum", "DateTime",