988e901066
Añade campos params y output al frontmatter YAML de las 506 funciones del registry. Cada parámetro tiene descripción semántica (qué representa, unidades, rango típico) y cada función describe qué produce su output. Permite a agentes razonar sobre cadenas de composición (ej: prices → log_return → sharpe_ratio) sin leer código.
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.