parser

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPath

func CanonicalPath(path string) (string, error)

CanonicalPath resolves Abs then EvalSymlinks with fall-back-to-Abs [L2].

Types

type Engine

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

Engine handles parsing of MySQL slow logs

func NewEngine

func NewEngine(store *storage.Storage, batchSize int, filePatterns []string, workers int) *Engine

NewEngine creates a new parser engine. filePatterns empty → defaults; workers < 1 → 1 (sequential).

func (*Engine) ParseDirectory

func (e *Engine) ParseDirectory(ctx context.Context, logDir string) (*ParseResult, error)

ParseDirectory parses all slow log files in a directory

func (*Engine) ParseFile

func (e *Engine) ParseFile(ctx context.Context, filePath string) (*ParseResult, error)

ParseFile parses a single slow log file

type ParseResult

type ParseResult struct {
	FilesProcessed int       `json:"files_processed"`
	FilesSkipped   int       `json:"files_skipped"`
	FilesFailed    int       `json:"files_failed"`
	EntriesParsed  int       `json:"entries_parsed"`
	EntriesStored  int       `json:"entries_stored"`
	Errors         []string  `json:"errors,omitempty"` // [L7] []string so JSON serializes
	StartTime      time.Time `json:"start_time"`
	EndTime        time.Time `json:"end_time"`
	DurationStr    string    `json:"duration"`
}

ParseResult represents the result of a parsing operation

func (*ParseResult) Duration

func (r *ParseResult) Duration() time.Duration

Duration returns the duration of the parsing operation

Jump to

Keyboard shortcuts

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