Help us shape the future of Go! Take the 2026 Go Developer Survey

dsn

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectDriver

func DetectDriver(raw string) (string, error)

DetectDriver infers the database driver name from a DSN string.

  • "postgres://" or "postgresql://" prefix -> "pgx"
  • Contains "@" (MySQL-style user:pass@tcp(...)/db) -> "mysql"
  • Contains "=" but not "@" (PostgreSQL key=value style) -> "pgx"
  • Otherwise -> error

func Open

func Open(raw string) (*sql.DB, error)

Open detects the driver from the DSN and opens a *sql.DB.

Types

This section is empty.

Jump to

Keyboard shortcuts

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