domain

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	Name     string
	Type     string
	Nullable bool
	Default  string
}

ColumnInfo represents information about a database column

type ConstraintInfo

type ConstraintInfo struct {
	Name              string
	Type              string
	Table             string
	Columns           []string
	ReferencedTable   string
	ReferencedColumns []string
}

ConstraintInfo represents information about a database constraint

type Database

type Database interface {
	Query(ctx context.Context, query string, args ...interface{}) (Rows, error)
	Exec(ctx context.Context, statement string, args ...interface{}) (Result, error)
	Begin(ctx context.Context, opts *TxOptions) (Tx, error)
}

Database represents a database connection and operations

type DatabaseRepository

type DatabaseRepository interface {
	GetDatabase(id string) (Database, error)
	ListDatabases() []string
	GetDatabaseType(id string) (string, error)
}

DatabaseRepository defines methods for managing database connections

type IndexInfo

type IndexInfo struct {
	Name    string
	Table   string
	Columns []string
	Unique  bool
	Primary bool
}

IndexInfo represents information about a database index

type PerformanceAnalyzer

type PerformanceAnalyzer interface {
	GetSlowQueries(limit int) ([]SlowQuery, error)
	GetMetrics() (PerformanceMetrics, error)
	AnalyzeQuery(query string) (QueryAnalysis, error)
	Reset() error
	SetThreshold(threshold int) error
}

PerformanceAnalyzer for analyzing database query performance

type PerformanceMetrics

type PerformanceMetrics struct {
	TotalQueries  int
	AvgDuration   float64
	MaxDuration   float64
	SlowQueries   int
	Threshold     int
	LastResetTime string
}

PerformanceMetrics represents database performance metrics

type QueryAnalysis

type QueryAnalysis struct {
	Query       string
	ExplainPlan string
}

QueryAnalysis represents the analysis of a SQL query

type Result

type Result interface {
	RowsAffected() (int64, error)
	LastInsertId() (int64, error)
}

Result represents the result of a database operation

type Rows

type Rows interface {
	Close() error
	Columns() ([]string, error)
	Next() bool
	Scan(dest ...interface{}) error
	Err() error
}

Rows represents database query results

type SchemaInfo

type SchemaInfo interface {
	GetTables() ([]string, error)
	GetColumns(table string) ([]ColumnInfo, error)
	GetIndexes(table string) ([]IndexInfo, error)
	GetConstraints(table string) ([]ConstraintInfo, error)
}

SchemaInfo represents database schema information

type SlowQuery

type SlowQuery struct {
	Query     string
	Duration  float64
	Timestamp string
}

SlowQuery represents a slow query that has been recorded

type Tx

type Tx interface {
	Commit() error
	Rollback() error
	Query(ctx context.Context, query string, args ...interface{}) (Rows, error)
	Exec(ctx context.Context, statement string, args ...interface{}) (Result, error)
}

Tx represents a database transaction

type TxOptions

type TxOptions struct {
	ReadOnly bool
}

TxOptions represents options for starting a transaction

Jump to

Keyboard shortcuts

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