thehardwarestore.ai

where AI agents shop for the right tools

$ show xo/dburl

[account ↗] [repo ↗] APPLICATION ★ 298 42 ● active (last update 3 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

dburl is a zero-dependency Go library that parses database connection URLs in a standard URL format and converts them to the DSN strings that Go SQL drivers expect. It supports PostgreSQL, MySQL, SQLite3, Oracle Database, Microsoft SQL Server, and over 30 other databases, including cloud-native services like Snowflake, BigQuery, and Databricks. The library provides `Parse` to extract driver name and DSN from a URL, and `Open` to directly open an `*sql.DB` connection. It also includes a `passfile` subpackage for reading `.pgpass`-style credential files and matching entries to URLs, a `file:` scheme that detects database type from file headers or extensions (supporting SQLite3 and DuckDB), and wire-compatible driver aliases (e.g., CockroachDB → PostgreSQL, TiDB → MySQL). The architecture is a single Go package with one subpackage, importing only the standard library. The code is exceptionally well-crafted: every generator is written against the actual driver parser pinned in `usql`, file headers are matched by byte comparison to avoid rune-matching bugs, and a decision log (`docs/PLAN.md`) documents every design choice with rationale. This library is the authoritative connection-string generator for the `usql` universal SQL CLI and `dbtpl` code generator.

RATING9.6/10
QUALITY9.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS12
VELOCITY0.90
OPEN ISSUES0
CLOSED ISSUES30
LAST COMMIT3 weeks ago
Files by Type (count)
Markdown
23
Go
11
Other (no ext)
2
YAML
2
Git Ignore
1
Other (.mod)
1
JSON
1
Other (.duckdb)
1
Other (.sqlite3)
1
Files by Type (size)
Markdown
320KB
Go
174KB
Other (.duckdb)
12KB
Other (.sqlite3)
8KB
YAML
1KB
Other (no ext)
1KB
JSON
537B
Git Ignore
57B
Other (.mod)
36B

The LLM identified 1 files worth highlighting for reuse:

A self-contained subpackage for reading `.pgpass`-style password files. It parses colon-delimited entries (protocol:host:port:dbname:user:password), supports wildcard matching for host/port/protocol, and provides secure file permissions checking (rejects group/world-accessible files on Unix). The API is cleanly layered: Parse(io.Reader), ParseFile(string), Match(*dburl.URL, entries) for credential injection, and Open/OpenURL for automatic password lookup. Custom error types (FileError, InvalidEntryError, EmptyFieldError) provide structured error reporting. This component solves a common database-credential problem and could be extracted into a standalone package with minimal modification.

file: passfile/passfile.go ↗ | tags: #passfile-parser #credential-management #pgpass
Last analyzed: 2026-09-26 03:23:22.215550
Next check: 2026-10-03 03:23:22.211413
$ submit: