Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
// Query execution
Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
// Prepared statements
Prepare(ctx context.Context, query string) (Statement, error)
// Transaction support
Begin(ctx context.Context) (Tx, error)
BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error)
// Health and diagnostics
Health(ctx context.Context) error
Stats() (map[string]interface{}, error)
// Connection management
Close() error
// Database-specific features
DatabaseType() string
// Migration support
GetMigrationTable() string
CreateMigrationTable(ctx context.Context) error
}
Interface defines the common database operations supported by the framework
type Statement ¶ added in v0.2.0
type Statement interface {
// Query execution
Query(ctx context.Context, args ...interface{}) (*sql.Rows, error)
QueryRow(ctx context.Context, args ...interface{}) *sql.Row
Exec(ctx context.Context, args ...interface{}) (sql.Result, error)
// Statement management
Close() error
}
Statement defines the interface for prepared statements
type Tx ¶ added in v0.2.0
type Tx interface {
// Query execution within transaction
Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
// Prepared statements within transaction
Prepare(ctx context.Context, query string) (Statement, error)
// Transaction control
Commit() error
Rollback() error
}
Tx defines the interface for database transactions
Click to show internal directories.
Click to hide internal directories.