Documentation
¶
Index ¶
- type DuckDBStore
- func (s *DuckDBStore) Close() error
- func (s *DuckDBStore) Init(ctx context.Context) error
- func (s *DuckDBStore) InsertLog(ctx context.Context, entry LogEntry) error
- func (s *DuckDBStore) InsertLogBatch(ctx context.Context, entries []LogEntry) error
- func (s *DuckDBStore) InsertPatterns(ctx context.Context, patterns []Pattern) error
- func (s *DuckDBStore) InternalDB() *sql.DB
- func (s *DuckDBStore) PatternCounts(ctx context.Context) (map[string]int, error)
- func (s *DuckDBStore) PatternSummaries(ctx context.Context) ([]PatternSummary, error)
- func (s *DuckDBStore) Patterns(ctx context.Context) ([]Pattern, error)
- func (s *DuckDBStore) QueryByPattern(ctx context.Context, pattern string) ([]LogEntry, error)
- func (s *DuckDBStore) QueryLogs(ctx context.Context, opts QueryOpts) ([]LogEntry, error)
- type LogEntry
- type Pattern
- type PatternSummary
- type QueryOpts
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DuckDBStore ¶
type DuckDBStore struct {
// contains filtered or unexported fields
}
DuckDBStore implements Store using DuckDB.
func NewDuckDBStore ¶
func NewDuckDBStore(dsn string) (*DuckDBStore, error)
NewDuckDBStore creates a new DuckDB-backed store. Pass dsn="" for in-memory, or a file path for persistent storage.
func (*DuckDBStore) Close ¶
func (s *DuckDBStore) Close() error
Close closes the underlying database connection.
func (*DuckDBStore) Init ¶
func (s *DuckDBStore) Init(ctx context.Context) error
Init creates the log_entries and patterns tables if they do not exist.
func (*DuckDBStore) InsertLog ¶
func (s *DuckDBStore) InsertLog(ctx context.Context, entry LogEntry) error
InsertLog stores a single log entry.
func (*DuckDBStore) InsertLogBatch ¶
func (s *DuckDBStore) InsertLogBatch(ctx context.Context, entries []LogEntry) error
InsertLogBatch stores multiple log entries in a single transaction.
func (*DuckDBStore) InsertPatterns ¶
func (s *DuckDBStore) InsertPatterns(ctx context.Context, patterns []Pattern) error
InsertPatterns upserts patterns into the patterns table.
func (*DuckDBStore) InternalDB ¶
func (s *DuckDBStore) InternalDB() *sql.DB
InternalDB returns the underlying *sql.DB for direct SQL queries.
func (*DuckDBStore) PatternCounts ¶
PatternCounts returns the number of log entries per pattern semantic ID.
func (*DuckDBStore) PatternSummaries ¶
func (s *DuckDBStore) PatternSummaries(ctx context.Context) ([]PatternSummary, error)
PatternSummaries returns all patterns with their occurrence counts, joined with pattern metadata from the patterns table.
func (*DuckDBStore) Patterns ¶
func (s *DuckDBStore) Patterns(ctx context.Context) ([]Pattern, error)
Patterns returns all patterns from the patterns table.
func (*DuckDBStore) QueryByPattern ¶
QueryByPattern returns log entries matching the given pattern semantic ID via labels.
type LogEntry ¶
type LogEntry struct {
ID int64
LineNumber int
EndLineNumber int
Timestamp time.Time
Raw string
Labels map[string]string
}
LogEntry represents a single stored log line.
type Pattern ¶
type Pattern struct {
PatternUUIDString string
PatternType string
RawPattern string
SemanticID string
Description string
}
Pattern represents a discovered log pattern with optional semantic labels.
type PatternSummary ¶
type PatternSummary struct {
PatternUUIDString string
Pattern string
Count int
PatternType string
SemanticID string
Description string
}
PatternSummary holds a pattern and its occurrence count.
type Store ¶
type Store interface {
// Init creates tables if they don't exist.
Init(ctx context.Context) error
// InsertLog stores a parsed log entry.
InsertLog(ctx context.Context, entry LogEntry) error
// InsertLogBatch stores multiple log entries.
InsertLogBatch(ctx context.Context, entries []LogEntry) error
// QueryByPattern returns entries matching a pattern semantic ID via labels.
QueryByPattern(ctx context.Context, pattern string) ([]LogEntry, error)
// QueryLogs returns entries matching the given options.
QueryLogs(ctx context.Context, opts QueryOpts) ([]LogEntry, error)
// PatternSummaries returns all patterns with their counts.
PatternSummaries(ctx context.Context) ([]PatternSummary, error)
// InsertPatterns upserts patterns into the patterns table.
InsertPatterns(ctx context.Context, patterns []Pattern) error
// Patterns returns all patterns.
Patterns(ctx context.Context) ([]Pattern, error)
// PatternCounts returns the number of log entries per pattern_id.
PatternCounts(ctx context.Context) (map[string]int, error)
// InternalDB returns the underlying *sql.DB for direct SQL queries.
// Only use this when no interface method covers the needed operation.
InternalDB() *sql.DB
// Close releases resources.
Close() error
}
Store persists log entries and patterns.