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

Class MaxValueValidator

tortoise/validators.py:89–101  ·  view source on GitHub ↗

Max value validator for FloatField, IntField, SmallIntField, BigIntField

Source from the content-addressed store, hash-verified

87
88
89class MaxValueValidator(NumericValidator):
90 """
91 Max value validator for FloatField, IntField, SmallIntField, BigIntField
92 """
93
94 def __init__(self, max_value: int | float | Decimal) -> None:
95 self._validate_type(max_value)
96 self.max_value = max_value
97
98 def __call__(self, value: int | float | Decimal) -> None:
99 self._validate_type(value)
100 if value > self.max_value:
101 raise ValidationError(f"Value should be less or equal to {self.max_value}")
102
103
104class CommaSeparatedIntegerListValidator(Validator):

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…