oprec

package
v0.0.0-...-db77838 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 5 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 oprec turns HTTP management mutations into audit operation records. It lives in the audit module and is consumed by other modules' HTTP adapters, so audit semantics (including recording failed operations) have a single source of truth.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audit

type Audit interface {
	RecordOperation(context.Context, auditusecase.OperationInput) (auditusecase.OperationLog, error)
}

Audit persists operation records; it is satisfied by the audit usecase.

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

Recorder records management operations for audit.

func New

func New(audit Audit) *Recorder

New creates an operation recorder backed by audit.

func (*Recorder) Record

func (r *Recorder) Record(c *echo.Context, action, resource, resourceID, message string, opErr error) error

Record fills the actor and request fields from the Echo context and records one management operation. A non-nil opErr marks the operation failed, and failed operations are recorded too. Record returns opErr when the operation failed (an audit failure is logged instead of masking it) and the audit error otherwise, so handlers call it on both paths:

result, opErr := h.usecase.DoSomething(ctx, input)
if err := h.audit.Record(c, "do", "thing", id, "did something", opErr); err != nil {
	return err
}
if opErr != nil {
	return opErr
}

Jump to

Keyboard shortcuts

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