audit

package
v1.0.0-alpha1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package audit records every change made to a persistent record.

It hooks the data layer rather than the HTTP layer, so a change is recorded whichever way it was made — an API call, the execution engine, a bootstrap step — and a request that changes nothing leaves nothing behind.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(gdb *gorm.DB) error

Register makes gdb record an Event for every row its repositories create, update or delete. Call it once per connection, before the first write.

The Event is inserted on the same connection as the change, so inside a transaction the two commit or roll back together: no change goes unrecorded, and none is recorded that did not happen. The corollary is that a failure to write the Event fails the change itself. An audit trail that can silently lose entries is not one.

The caller is read from the context the repository was given. A repository call made without one — the execution engine's, for instance — is recorded as SystemActor.

Two things are not seen. Rows removed by a foreign key's ON DELETE CASCADE are removed by the database, so only the record that was deleted is recorded. And a write made through raw SQL bypasses the model entirely.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL