mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-26 02:44:33 +02:00
Fixed bug I introduced with register_function()
This commit is contained in:
parent
2da7af10a4
commit
cf92a29c2e
1 changed files with 7 additions and 1 deletions
|
|
@ -264,7 +264,7 @@ class Database:
|
|||
return "<Database {}>".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
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue