MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / MinValueValidator

Class MinValueValidator

tortoise/validators.py:74–86  ·  view source on GitHub ↗

Min value validator for FloatField, IntField, SmallIntField, BigIntField

Source from the content-addressed store, hash-verified

72
73
74class MinValueValidator(NumericValidator):
75 """
76 Min value validator for FloatField, IntField, SmallIntField, BigIntField
77 """
78
79 def __init__(self, min_value: int | float | Decimal) -> None:
80 self._validate_type(min_value)
81 self.min_value = min_value
82
83 def __call__(self, value: int | float | Decimal) -> None:
84 self._validate_type(value)
85 if value < self.min_value:
86 raise ValidationError(f"Value should be greater or equal to {self.min_value}")
87
88
89class MaxValueValidator(NumericValidator):

Callers 1

ValidatorModelClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…