types

package
v0.0.0-...-b8497f2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package types contains shared data structures and constants used across the application.

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigPath = "configs/default.yaml"
View Source
var Version = "dev"

Functions

This section is empty.

Types

type BenchmarkConfig

type BenchmarkConfig struct {
	Executor      string        `mapstructure:"executor"`
	QPS           int           `mapstructure:"qps"`
	Concurrency   int           `mapstructure:"concurrency"`
	SlowThreshold time.Duration `mapstructure:"slow_threshold"`
}

BenchmarkConfig holds the benchmark configuration.

type BenchmarkStatus

type BenchmarkStatus int
const (
	StatusPending BenchmarkStatus = iota
	StatusRunning
	StatusCompleted
	StatusFailed
	StatusCancelled
)

func (BenchmarkStatus) String

func (b BenchmarkStatus) String() string

type Config

type Config struct {
	Log       LogConfig       `mapstructure:"log"`
	Database  DatabaseConfig  `mapstructure:"database"`
	Benchmark BenchmarkConfig `mapstructure:"benchmark"`
}

Config holds the application's configuration.

type DatabaseConfig

type DatabaseConfig struct {
	Driver string `mapstructure:"driver"`
	DSN    string `mapstructure:"dsn"`
}

DatabaseConfig holds the database configuration.

type DatabaseType

type DatabaseType int
const (
	DatabaseNone DatabaseType = iota
	DatabaseStarRocks
	DatabaseClickHouse
	DatabaseMySQL
	DatabasePostgreSQL
	DatabaseTiDB
	DatabaseDoris
	DatabaseMongoDB
)

func DatabaseTypeFromString

func DatabaseTypeFromString(s string) DatabaseType

func (DatabaseType) String

func (d DatabaseType) String() string

type DistributionType

type DistributionType int
const (
	DistributionUniform DistributionType = iota
	DistributionNormal
	DistributionZipfian
	DistributionExponential
)

func (DistributionType) String

func (d DistributionType) String() string

type ErrorCode

type ErrorCode string

ErrorCode defines a typed string for application-specific error codes.

const (
	ErrInvalidInput       ErrorCode = "invalid_input"
	ErrParseFailed        ErrorCode = "parse_failed"
	ErrNotFound           ErrorCode = "not_found"
	ErrDatabaseConnection ErrorCode = "database_connection"
	ErrPluginNotFound     ErrorCode = "plugin_not_found"
	ErrValidationFailed   ErrorCode = "validation_failed"
	ErrExecutionFailed    ErrorCode = "execution_failed"
	ErrReportGeneration   ErrorCode = "report_generation"
	ErrInternal           ErrorCode = "internal"
)

Defines the set of standard error codes.

type LogConfig

type LogConfig struct {
	Level  string `mapstructure:"level"`
	Format string `mapstructure:"format"`
}

LogConfig holds the logging configuration.

type ParameterType

type ParameterType int
const (
	TypeInteger ParameterType = iota
	TypeString
	TypeFloat
	TypeBoolean
	TypeDateTime
	TypeJSON
)

func (ParameterType) String

func (p ParameterType) String() string

type QueryType

type QueryType int
const (
	QuerySelect QueryType = iota
	QueryInsert
	QueryUpdate
	QueryDelete
	QueryDDL
	QueryOther
)

func (QueryType) String

func (q QueryType) String() string

type SQLTraceBenchError

type SQLTraceBenchError struct {
	Code    ErrorCode
	Message string
	Cause   error
}

SQLTraceBenchError is a custom error type for the application. It includes a machine-readable error code, a human-readable message, and the underlying error that caused it.

func NewError

func NewError(code ErrorCode, message string) *SQLTraceBenchError

NewError creates a new SQLTraceBenchError.

func WrapError

func WrapError(code ErrorCode, message string, cause error) *SQLTraceBenchError

WrapError creates a new SQLTraceBenchError that wraps an existing error.

func (*SQLTraceBenchError) Error

func (e *SQLTraceBenchError) Error() string

Error returns the string representation of the SQLTraceBenchError.

Jump to

Keyboard shortcuts

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