Help us shape the future of Go! Take the 2026 Go Developer Survey

repository

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryRepository

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

MemoryRepository handles all database operations for memory management

func NewMemoryRepository

func NewMemoryRepository(db *sql.DB, logger *log.Logger) *MemoryRepository

NewMemoryRepository creates a new memory repository

func (*MemoryRepository) AnalyzeRiskCorrelation

func (r *MemoryRepository) AnalyzeRiskCorrelation(ctx context.Context, sessionID string) ([]*models.RiskCorrelation, error)

AnalyzeRiskCorrelation analyzes correlations between vulnerabilities

func (*MemoryRepository) BatchCreateMemoryEntries

func (r *MemoryRepository) BatchCreateMemoryEntries(ctx context.Context, sessionID string, requests []*models.CreateMemoryEntryRequest) ([]*models.MemoryEntry, error)

BatchCreateMemoryEntries creates multiple memory entries in a single transaction

func (*MemoryRepository) BatchDeleteMemoryEntries

func (r *MemoryRepository) BatchDeleteMemoryEntries(ctx context.Context, memoryIDs []string) error

BatchDeleteMemoryEntries deletes multiple memory entries in a single transaction

func (*MemoryRepository) BatchUpdateMemoryEntries

func (r *MemoryRepository) BatchUpdateMemoryEntries(ctx context.Context, updates []*models.UpdateMemoryEntryRequest) ([]*models.MemoryEntry, error)

BatchUpdateMemoryEntries updates multiple memory entries in a single transaction

func (*MemoryRepository) CalculateSemanticSimilarity

func (r *MemoryRepository) CalculateSemanticSimilarity(embedding1, embedding2 []float64) (float64, error)

CalculateSemanticSimilarity calculates similarity between two embeddings (placeholder)

func (*MemoryRepository) CheckForDuplicateMemories

func (r *MemoryRepository) CheckForDuplicateMemories(ctx context.Context, sessionID string) error

CheckForDuplicateMemories checks for potential duplicate memories and creates notifications

func (*MemoryRepository) CheckForDuplicates

func (r *MemoryRepository) CheckForDuplicates(ctx context.Context, sessionID, title, content string) ([]models.MemoryEntry, error)

CheckForDuplicates checks if a memory entry is a duplicate of existing entries

func (*MemoryRepository) CheckForHighPriorityMemories

func (r *MemoryRepository) CheckForHighPriorityMemories(ctx context.Context, sessionID string) error

CheckForHighPriorityMemories checks for high-priority memories and creates notifications

func (*MemoryRepository) CleanupLowPriorityMemories

func (r *MemoryRepository) CleanupLowPriorityMemories(ctx context.Context, maxPriority int, maxConfidence float64, dryRun bool) (int, error)

CleanupLowPriorityMemories removes memories with low priority and confidence

func (*MemoryRepository) CleanupOldMemories

func (r *MemoryRepository) CleanupOldMemories(ctx context.Context, maxAgeDays int, dryRun bool) (int, error)

CleanupOldMemories removes memories older than the specified age

func (*MemoryRepository) CleanupUnusedMemories

func (r *MemoryRepository) CleanupUnusedMemories(ctx context.Context, maxUnusedDays int, dryRun bool) (int, error)

CleanupUnusedMemories removes memories that haven't been accessed recently

func (*MemoryRepository) CreateCleanupNotification

func (r *MemoryRepository) CreateCleanupNotification(ctx context.Context, cleanupType string, count int, sessionID string) error

CreateCleanupNotification creates a notification when cleanup operations are performed

func (*MemoryRepository) CreateContextSnapshot

func (r *MemoryRepository) CreateContextSnapshot(ctx context.Context, sessionID, name, description string, contextData map[string]interface{}) (*models.ContextSnapshot, error)

CreateContextSnapshot creates a snapshot of the current context for a session

func (*MemoryRepository) CreateMemoryCreatedNotification

func (r *MemoryRepository) CreateMemoryCreatedNotification(ctx context.Context, memory *models.MemoryEntry) error

CreateMemoryCreatedNotification creates a notification when a memory is created

func (*MemoryRepository) CreateMemoryEntry

CreateMemoryEntry creates a new memory entry

func (*MemoryRepository) CreateMemoryFromTemplate

func (r *MemoryRepository) CreateMemoryFromTemplate(ctx context.Context, sessionID, templateName string, replacements map[string]string) (*models.MemoryEntry, error)

CreateMemoryFromTemplate creates a memory entry from a predefined template

func (*MemoryRepository) CreateNotification

func (r *MemoryRepository) CreateNotification(ctx context.Context, notification *Notification) error

CreateNotification creates a new notification

func (*MemoryRepository) CreateRelationship

CreateRelationship creates a relationship between two memory entries

func (*MemoryRepository) CreateSession

func (r *MemoryRepository) CreateSession(ctx context.Context, session *models.Session) error

CreateSession creates a new session

func (*MemoryRepository) CreateTaskProgress

func (r *MemoryRepository) CreateTaskProgress(ctx context.Context, sessionID, taskName, stage, status, notes string, progressPercentage int) (*models.TaskProgress, error)

CreateTaskProgress creates a new task progress entry

func (*MemoryRepository) ExportSessionData

func (r *MemoryRepository) ExportSessionData(ctx context.Context, sessionID string) (map[string]interface{}, error)

ExportSessionData exports all data for a session in JSON format

func (*MemoryRepository) FindSimilarMemories

func (r *MemoryRepository) FindSimilarMemories(ctx context.Context, sessionID, content string, threshold float64) ([]models.MemoryEntry, error)

FindSimilarMemories finds memories similar to the given content

func (*MemoryRepository) GenerateEmbedding

func (r *MemoryRepository) GenerateEmbedding(ctx context.Context, text string) ([]float64, error)

GenerateEmbedding generates an embedding for text (placeholder for future implementation)

func (*MemoryRepository) GetCVEMapping

func (r *MemoryRepository) GetCVEMapping(ctx context.Context, sessionID, cweID string) (*models.CVEMapping, error)

GetCVEMapping retrieves CVE mapping for a CWE

func (*MemoryRepository) GetContextSnapshot

func (r *MemoryRepository) GetContextSnapshot(ctx context.Context, snapshotID string) (*models.ContextSnapshot, error)

GetContextSnapshot retrieves a context snapshot by ID

func (*MemoryRepository) GetDetailedMemoryInfo

func (r *MemoryRepository) GetDetailedMemoryInfo(ctx context.Context, memoryID string) (map[string]interface{}, error)

GetDetailedMemoryInfo returns comprehensive information about a memory entry for debugging

func (*MemoryRepository) GetMemoryEntry

func (r *MemoryRepository) GetMemoryEntry(ctx context.Context, entryID string) (*models.MemoryEntry, error)

GetMemoryEntry retrieves a memory entry by ID and updates access tracking

func (*MemoryRepository) GetMemoryStats

func (r *MemoryRepository) GetMemoryStats(ctx context.Context) (map[string]interface{}, error)

GetMemoryStats returns statistics about memory usage and aging

func (*MemoryRepository) GetNotifications

func (r *MemoryRepository) GetNotifications(ctx context.Context, sessionID string, limit int, offset int) ([]*Notification, error)

GetNotifications retrieves notifications for a session

func (*MemoryRepository) GetRelatedEntries

func (r *MemoryRepository) GetRelatedEntries(ctx context.Context, entryID string, relationshipType string, limit int) ([]*models.MemoryEntry, error)

GetRelatedEntries retrieves entries related to a given entry

func (*MemoryRepository) GetSecurityTemplates

func (r *MemoryRepository) GetSecurityTemplates() map[string]interface{}

GetSecurityTemplates returns predefined templates for common security patterns

func (*MemoryRepository) GetSession

func (r *MemoryRepository) GetSession(ctx context.Context, sessionID string) (*models.Session, error)

GetSession retrieves a session by ID

func (*MemoryRepository) GetSystemDiagnostics

func (r *MemoryRepository) GetSystemDiagnostics(ctx context.Context) (map[string]interface{}, error)

GetSystemDiagnostics returns comprehensive system diagnostics for debugging

func (*MemoryRepository) GetTaskProgress

func (r *MemoryRepository) GetTaskProgress(ctx context.Context, taskID string) (*models.TaskProgress, error)

GetTaskProgress retrieves a task progress entry by ID

func (*MemoryRepository) ImportSessionData

func (r *MemoryRepository) ImportSessionData(ctx context.Context, importData map[string]interface{}) (string, error)

ImportSessionData imports session data from JSON format

func (*MemoryRepository) ListContextSnapshots

func (r *MemoryRepository) ListContextSnapshots(ctx context.Context, sessionID string, limit, offset int) ([]*models.ContextSnapshot, error)

ListContextSnapshots lists context snapshots for a session

func (*MemoryRepository) ListSessions

func (r *MemoryRepository) ListSessions(ctx context.Context, taskType string, status string, limit, offset int) ([]*models.Session, error)

ListSessions retrieves all sessions with optional filtering

func (*MemoryRepository) ListTaskProgress

func (r *MemoryRepository) ListTaskProgress(ctx context.Context, sessionID string, status string, limit, offset int) ([]*models.TaskProgress, error)

ListTaskProgress lists task progress entries for a session

func (*MemoryRepository) MapToCVE

func (r *MemoryRepository) MapToCVE(ctx context.Context, sessionID, cweID string) (*models.CVEMapping, error)

MapToCVE maps a CWE to known CVE entries

func (*MemoryRepository) MapToCompliance

func (r *MemoryRepository) MapToCompliance(ctx context.Context, sessionID, standard string) (*models.ComplianceMapping, error)

MapToCompliance maps vulnerabilities to compliance standards

func (*MemoryRepository) MarkNotificationRead

func (r *MemoryRepository) MarkNotificationRead(ctx context.Context, notificationID string) error

MarkNotificationRead marks a notification as read

func (*MemoryRepository) SearchMemoryEntries

func (r *MemoryRepository) SearchMemoryEntries(ctx context.Context, req *models.SearchRequest) ([]*models.SearchResult, error)

SearchMemoryEntries performs a search across memory entries

func (*MemoryRepository) SemanticSearch

func (r *MemoryRepository) SemanticSearch(ctx context.Context, query string, sessionID string, limit int) ([]*models.MemoryEntry, error)

SemanticSearch performs semantic search using embeddings (placeholder for future implementation)

func (*MemoryRepository) StoreEmbedding

func (r *MemoryRepository) StoreEmbedding(ctx context.Context, memoryID string, embedding []float64) error

StoreEmbedding stores an embedding for a memory entry (placeholder)

func (*MemoryRepository) UpdateTaskProgress

func (r *MemoryRepository) UpdateTaskProgress(ctx context.Context, taskID, stage, status, notes string, progressPercentage int) (*models.TaskProgress, error)

UpdateTaskProgress updates an existing task progress entry

type Notification

type Notification struct {
	ID        string                 `json:"id"`
	Type      string                 `json:"type"` // "memory_created", "memory_updated", "duplicate_found", "high_priority", "cleanup_performed"
	Title     string                 `json:"title"`
	Message   string                 `json:"message"`
	MemoryID  string                 `json:"memory_id,omitempty"`
	SessionID string                 `json:"session_id,omitempty"`
	Priority  int                    `json:"priority"`
	Metadata  map[string]interface{} `json:"metadata"`
	CreatedAt time.Time              `json:"created_at"`
	Read      bool                   `json:"read"`
}

Notification represents a memory-related notification

type NotificationService

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

NotificationService handles real-time memory notifications and alerts

type SecurityRepository

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

SecurityRepository handles security data operations

func NewSecurityRepository

func NewSecurityRepository(db *database.Database, logger *log.Logger) *SecurityRepository

NewSecurityRepository creates a new security repository

func (*SecurityRepository) GetSecurityDataSummary

func (r *SecurityRepository) GetSecurityDataSummary(ctx context.Context) (map[string]models.SecurityDataSummary, error)

GetSecurityDataSummary returns a summary of security data

func (*SecurityRepository) QueryATTACK

QueryATTACK searches ATT&CK data based on criteria

func (*SecurityRepository) QueryNVD

QueryNVD searches NVD data based on criteria

func (*SecurityRepository) StoreATTACKDataset

func (r *SecurityRepository) StoreATTACKDataset(ctx context.Context, techniques []models.ATTACKTechnique, tactics []models.ATTACKTactic) error

StoreATTACKDataset stores MITRE ATT&CK data in the database

func (*SecurityRepository) StoreNVDDataset

func (r *SecurityRepository) StoreNVDDataset(ctx context.Context, cves []models.NVDCVE) error

StoreNVDDataset stores NVD CVE data in the database

func (*SecurityRepository) UpdateSecurityDataStatus

func (r *SecurityRepository) UpdateSecurityDataStatus(ctx context.Context, dataSource string, status string, totalRecords *int, errorMessage *string) error

UpdateSecurityDataStatus updates the status of security data updates

type SecurityRepositoryInterface

type SecurityRepositoryInterface interface {
	StoreNVDDataset(ctx context.Context, cves []models.NVDCVE) error
	StoreATTACKDataset(ctx context.Context, techniques []models.ATTACKTechnique, tactics []models.ATTACKTactic) error
	QueryNVD(ctx context.Context, req models.NVDSearchRequest) ([]models.NVDCVE, int, error)
	QueryATTACK(ctx context.Context, req models.ATTACKSearchRequest) ([]models.ATTACKTechnique, int, error)
	GetSecurityDataSummary(ctx context.Context) (map[string]models.SecurityDataSummary, error)
	UpdateSecurityDataStatus(ctx context.Context, dataSource string, status string, totalRecords *int, errorMessage *string) error
}

SecurityRepositoryInterface defines the interface for security data operations

Jump to

Keyboard shortcuts

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