29 lines
597 B
Python
29 lines
597 B
Python
"""
|
|
datalite.constraints module introduces constraint
|
|
types that can be used to hint field variables,
|
|
that can be used to signal datalite decorator
|
|
constraints in the database.
|
|
"""
|
|
from typing import Tuple, TypeVar, Union
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class ConstraintFailedError(Exception):
|
|
"""
|
|
This exception is raised when a Constraint fails.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
"""
|
|
Dataclass fields hinted with this type signals
|
|
datalite that the bound column of this
|
|
field in the table is NOT NULL and UNIQUE.
|
|
"""
|
|
Unique = Union[Tuple[T], T]
|
|
|
|
|
|
__all__ = ['Unique', 'ConstraintFailedError']
|