Documentation
¶
Overview ¶
Package db provides database operations for storing benchmark results and schedules.
Index ¶
- type DB
- func (db *DB) Close() error
- func (db *DB) Conn() *sql.DB
- func (db *DB) CreateResult(runID int64, metric string, value float64, unit string) error
- func (db *DB) CreateResults(runID int64, metrics map[string]float64, units map[string]string) error
- func (db *DB) CreateRun(plugin string, params JSONData) (*Run, error)
- func (db *DB) ExportAllCSV(w io.Writer) error
- func (db *DB) ExportCSV(w io.Writer, runID int64) error
- func (db *DB) ExportJSON(w io.Writer, runID int64) error
- func (db *DB) GetResults(runID int64) ([]*Result, error)
- func (db *DB) GetRun(id int64) (*Run, error)
- func (db *DB) ListResults(filter ResultFilter) ([]*Result, error)
- func (db *DB) ListRuns(filter RunFilter) ([]*Run, error)
- func (db *DB) Migrate() error
- func (db *DB) Path() string
- func (db *DB) UpdateRun(run *Run) error
- type ExportFormat
- type JSONData
- type Result
- type ResultFilter
- type Run
- type RunFilter
- type RunStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the SQL database connection
func (*DB) CreateResult ¶
CreateResult creates a new result record
func (*DB) CreateResults ¶
CreateResults creates multiple result records in a transaction
func (*DB) ExportAllCSV ¶
ExportAllCSV exports all runs and results to CSV format
func (*DB) ExportJSON ¶
ExportJSON exports results to JSON format
func (*DB) GetResults ¶
GetResults retrieves results for a run
func (*DB) ListResults ¶
func (db *DB) ListResults(filter ResultFilter) ([]*Result, error)
ListResults retrieves results based on filters
type ExportFormat ¶
type ExportFormat string
ExportFormat represents the format for exporting data
const ( ExportFormatCSV ExportFormat = "csv" ExportFormatJSON ExportFormat = "json" )
ExportFormat constants define the available export formats.
type JSONData ¶
type JSONData map[string]interface{}
JSONData is a custom type for storing JSON in SQLite
type Result ¶
type Result struct {
ID int64 `json:"id"`
RunID int64 `json:"run_id"`
Metric string `json:"metric"`
Value float64 `json:"value"`
Unit string `json:"unit"`
CreatedAt time.Time `json:"created_at"`
}
Result represents a metric result from a test run
type ResultFilter ¶
ResultFilter represents filters for querying results
type Run ¶
type Run struct {
ID int64 `json:"id"`
Plugin string `json:"plugin"`
Params JSONData `json:"params"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time"`
ExitCode int `json:"exit_code"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Run represents a test execution record
type RunFilter ¶
type RunFilter struct {
Plugin string
StartTime *time.Time
EndTime *time.Time
Success *bool
Limit int
Offset int
}
RunFilter represents filters for querying runs