dsn

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 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