-
Notifications
You must be signed in to change notification settings - Fork 5
Functions
There is possibility to use in a rule the database native functions.
About PostgreSQL native functions, you can read (here).
For example, the NOW() function, returns the current time as timestamp. So we can create a simple rule using this function.
The JSON structure forces us to write the function name as a string. So, to distinguish the name of the function from the regular text, add the #func: prefix before the function name. Databukcet server read such a string as a function.
{
"rules": [
["createdAt", "<", "#func:NOW()"]
]
} The above example is correct, but it does not make much sense, because it is always true. How can we modify this example, to get all data created at least one day ago? To create this rule, we can use another function named "INTERVAL":
{
"rules": [
["createdAt", "<", "#func:NOW() - INTERVAL '1 DAY'"]
]
} We can also verify the correctness of such a function structures through SQL query:
select NOW() - INTERVAL '1 DAY';If the SQL query works, the rule also should work.

Wiki
Work in the project
- Navigation
- Searching
- Filtering
- Create/modify/remove data
- Data reservation
- Data details
- Data history
- Tasks execution
- Data export
Project settings
Management
API