47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.6 KiB
1.6 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| postgres_open | function | go | infra | 1.0.0 | impure | func PostgresOpen(host string, port int, user, password, dbname string, sslmode string) (*sql.DB, error) | Conecta a PostgreSQL construyendo el DSN desde parametros individuales. sslmode por defecto 'disable' si vacio. |
|
|
false | error_go_core |
|
|
conexion sql.DB abierta a PostgreSQL | false | functions/infra/postgres_open.go |
Ejemplo
db, err := PostgresOpen("localhost", 5432, "user", "secret", "mydb", "disable")
if err != nil {
log.Fatal(err)
}
defer DBClose(db)
rows, err := DBQuery(db, "SELECT id, name FROM users WHERE active = $1", true)
Notas
Usa el driver github.com/jackc/pgx/v5/stdlib registrado como "pgx". Construye DSN con los parametros separados para mayor legibilidad. Para produccion usar sslmode=require o sslmode=verify-full. Hace ping al abrir para verificar conectividad.