#audit #change #postgresql #sql #track

sql-audit

A companion library to sql-audit-cli implementing all of the same functionality, plus useful runtime operations

1 unstable release

0.1.0 Dec 17, 2020

#31 in #audit


Used in sql-audit-cli

MIT license

12KB
170 lines

A companion library to sql-audit-cli implementing all of the same functionality, plus useful runtime operations like:

  1. Set current app_user
  2. Set current request_id
  3. Query audit database

lib.rs:

The companion library to sql-audit-cli, though you can just use this instead if you'd like to generate audit programmatically.

Limitations

  1. Currently this lib only knows how to use sqlx, so you must use it too.

Tour

  • generate_audit is the programmatic equivalent of running sql-audit-cli.
  • query_audit lets you query the audit table... currently only supports querying all records for a table.
  • set_local_app_user sets the value to fill into app_user in the audit table for the duration of the current transaction.
  • set_local_request_id sets the value to fill into request_id in the audit table for the duration of the current transaction.

Dependencies

~23–33MB
~625K SLoC