Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface {
// Open creates a new database connection using the provided configuration.
Open(config database.ConnectionConfig) (*sql.DB, error)
// Name returns the driver name (e.g. "postgres", "mysql", "sqlite3").
Name() string
}
Driver defines the contract for a database driver that can open connections.
type MySQLDriver ¶
type MySQLDriver struct{}
MySQLDriver implements the Driver interface for MySQL.
func (*MySQLDriver) Name ¶
func (d *MySQLDriver) Name() string
Name returns the driver name used for sql.Open registration.
func (*MySQLDriver) Open ¶
func (d *MySQLDriver) Open(config database.ConnectionConfig) (*sql.DB, error)
Open creates a MySQL database connection using the provided config. It builds a DSN in the format: user:password@tcp(host:port)/dbname?params
type PostgresDriver ¶
type PostgresDriver struct{}
PostgresDriver implements the Driver interface for PostgreSQL.
func NewPostgresDriver ¶
func NewPostgresDriver() *PostgresDriver
NewPostgresDriver creates a new PostgresDriver.
func (*PostgresDriver) Name ¶
func (d *PostgresDriver) Name() string
Name returns the driver name used for sql.Open registration.
func (*PostgresDriver) Open ¶
func (d *PostgresDriver) Open(config database.ConnectionConfig) (*sql.DB, error)
Open creates a PostgreSQL database connection using the provided config. It builds a DSN in the format: host=X port=Y user=Z password=W dbname=D sslmode=disable
type SQLiteDriver ¶
type SQLiteDriver struct{}
SQLiteDriver implements the Driver interface for SQLite.
func NewSQLiteDriver ¶
func NewSQLiteDriver() *SQLiteDriver
NewSQLiteDriver creates a new SQLiteDriver.
func (*SQLiteDriver) Name ¶
func (d *SQLiteDriver) Name() string
Name returns the driver name used for sql.Open registration.
func (*SQLiteDriver) Open ¶
func (d *SQLiteDriver) Open(config database.ConnectionConfig) (*sql.DB, error)
Open creates a SQLite database connection using the provided config. It uses the Database field as the file path (e.g. "./data.db" or ":memory:").