Skip to content

Functions

samatstarion edited this page Aug 28, 2024 · 5 revisions

Functions

SiteDirectory:

[ThingName]_Data()

For every normal and cross Thing table, a Function exists that gets data from the (normal/cross) [ThingName] table and combines that with data from the [ThingName_Audit] table, based on the current Session instant.

SiteDirectory.end_all_current_data_validity(partition_name text)

Loops through all the _Audit tables, disables all triggers, sets all ValidTo column values in the rows to 'Infinity'.

get_audit_enabled()

Checks if creation of rows in [*]_Audit tables should be performed. This is a property that can be set in the transaction_info table that is (temporarily) created during a Database Transaction.

get_current_revision()

Tries to get the current Revision number from the RevisionRegistry table for this transaction. Creates a new entry in the RevisionRegistry table if it is not yet there.

get_session_instant()

Tries to get the current Session instant (TimeStamp) from the transaction_info table that is (temporarily) created during a Database Transaction. Returns infinity if it isn't found.

get_session_timeframe_start()

Tries to get the period_start (TimeStamp) from the transaction_info table that is (temporarily) created during a Database Transaction. Returns -infinity (negative infinity) if it isn't found.

get_session_user() Tries to get the user_id from the transaction_info table that is (temporarily) created during a Database Transaction. Returns NULL if it isn't found.

get_transaction_time()

Tries to get the transaction_time from the transaction_info table that is (temporarily) created during a Database Transaction. Returns statement_timestamp() Postgres timestamp function if it isn't found.

insert_data_from_audit(partition_name text, instant timestamp without time zone))

Loops through all the */_Audit tables and inserts data that was valid in a specific period from the audit table to its counterpart normal / cross table.

EngineeringModel

[ThingName]_Data()

For every normal and cross Thing table, a Function exists that gets data from the (normal/cross) [ThingName] table and combines that with data from the [ThingName_Audit] table, based on the current Session instant.

get_current_revision()

Tries to get the current Revision number from the RevisionRegistry table for this transaction. Creates a new entry in the RevisionRegistry table if it is not yet there.

Iteration

[ThingName]_Data()

For every normal and cross Thing table, a Function exists that gets data from the (normal/cross) [ThingName] table and combines that with data from the [ThingName_Audit] table, based on the current Session instant.