diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 7ef6384..eaa9d65 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -264,7 +264,7 @@ class Database: return "".format(self.conn) def register_function( - self, fn: Callable, deterministic: bool = False, replace: bool = False + self, fn: Callable=None, deterministic: bool = False, replace: bool = False ): """ ``fn`` will be made available as a function within SQL, with the same name and number @@ -274,6 +274,12 @@ class Database: def upper(value): return str(value).upper() + The decorator can take arguments:: + + @db.register(deterministic=True, replace=True) + def upper(value): + return str(value).upper() + - ``deterministic`` - set ``True`` for functions that always returns the same output for a given input - ``replace`` - set ``True`` to replace an existing function with the same name - otherwise throw an error """