def connect.to
bend-kit-postgres@0.3.0.0 · postgres.bend:448
import bend-kit-postgres@0.3.0.0/postgres.bend as Postgres
import Base
import bend-kit-dns@0.7.0.0/dns.bend as Dns
448def connect.to(+k: String, cfg: Config) -> IO(Result<&1, &1, Failure, Conn>):
449 Config{+host, +port, +tls, +user, +pass, +db, +ms} = cfg
450 do IO<Result<&1, &1, Failure, Conn>>:
451 ips : List<&2, String> <- Dns.resolve.all(host)
452 r : Result<&1, &1, U32 & String, Socket> <- dial(ips, port, ms, IO.pure(Result<&1, &1, U32 & String, Socket>, Fail{(0, "no address for " ++ host)}))
453 dialed(r, tls, k, host, user, pass, db, ms)