command

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package command supplies the explicit audit retention operation. Parse before boot; Run borrows the application's configured audit scope and database.

Index

Constants

View Source
const DefaultBatch = 500

Variables

This section is empty.

Functions

func Declaration

func Declaration(construct func(foundation.Resolver) (*audit.Scope, error), now clock.Clock) (cli.Declaration, error)

Declaration registers the audit command in the ordinary CLI registry. The constructor resolves the configured scope after boot; parsing does no I/O.

Types

type Command

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

Command is a validated immutable prune operation. Without --before it uses the recorder's configured retention; with it, the explicit RFC 3339 cutoff, which must not be later than the current time. Without --apply it only counts the matching entries; --apply removes them.

func Parse

func Parse(args []string, help io.Writer) (Command, error)

Parse parses audit prune arguments without database I/O. It requires a help writer and returns flag.ErrHelp after writing requested help.

func (Command) Run

func (c Command) Run(ctx context.Context, scope *audit.Scope, now clock.Clock, output io.Writer) error

Run counts the entries older than the cutoff or, with --apply, removes them in bounded transactions and reports the committed count, also when a later batch fails. A cutoff later than now is rejected before any database work. It never prints audit payloads.

Jump to

Keyboard shortcuts

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