neuralib.sqlp.annotation.check

neuralib.sqlp.annotation.check(field=None)[source]

A decorator to make a check constraint.

  1. by a field

>>> class Example:
...     a: str
...     @check('a')
...     def check_a(self):
...         return self.a != ''
  1. by over all

>>> class Example:
...     a: str
...     @check()
...     def check_a(self):
...         return self.a != ''
Parameters:

field (str | None) – field name.