deletion

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeletionRequest

type DeletionRequest struct {
	// Operation type
	Type DeletionType

	// Single deletion
	RecordID int64

	// Pattern deletion
	Pattern string

	// Options
	DryRun      bool
	Force       bool   // Skip confirmations
	ExportFirst string // Export path before deletion
}

DeletionRequest represents a deletion operation request

type DeletionResult

type DeletionResult struct {
	DeletedCount   int64
	MatchedRecords []*storage.CommandRecord // For dry-run preview
	Duration       time.Duration
	ExportedTo     string
	Errors         []error
}

DeletionResult contains the results of a deletion operation

type DeletionService

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

DeletionService handles all command deletion operations

func NewDeletionService

func NewDeletionService(
	storage *securestorage.SecureStorage,
	cache *cache.Cache,
	searchService *search.SearchService,
	authManager *auth.AuthManager,
	config *config.Config,
) *DeletionService

NewDeletionService creates a new deletion service

func (*DeletionService) DeleteAll

func (ds *DeletionService) DeleteAll(exportFirst string, force bool) (*DeletionResult, error)

DeleteAll deletes all command history

func (*DeletionService) DeletePattern

func (ds *DeletionService) DeletePattern(pattern string, dryRun bool, force bool) (*DeletionResult, error)

DeletePattern deletes all records matching a pattern

func (*DeletionService) DeleteRecord

func (ds *DeletionService) DeleteRecord(recordID int64, force bool) (*DeletionResult, error)

DeleteRecord deletes a single command record by ID

func (*DeletionService) ExecuteDeletion

func (ds *DeletionService) ExecuteDeletion(req *DeletionRequest) (*DeletionResult, error)

ExecuteDeletion executes a deletion request

func (*DeletionService) GetDeletionStats

func (ds *DeletionService) GetDeletionStats(req *DeletionRequest) (*DeletionStats, error)

GetDeletionStats returns statistics about what would be deleted

func (*DeletionService) ValidatePattern

func (ds *DeletionService) ValidatePattern(pattern string) error

ValidatePattern validates a deletion pattern for safety

type DeletionStats

type DeletionStats struct {
	TotalMatches int64
	OldestRecord time.Time
	NewestRecord time.Time
	Patterns     map[string]int // Command patterns and their counts
}

DeletionStats provides statistics about a deletion operation

type DeletionType

type DeletionType int

DeletionType represents the type of deletion operation

const (
	DeleteSingle DeletionType = iota
	DeletePattern
	DeleteAll
)

Jump to

Keyboard shortcuts

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