init (options.go)

pg · options.go · go · BSD-2-Clause
database

PostgreSQL connection options with pooling, timeouts, and TLS configuration

// Source: https://github.com/go-pg/pg | License: BSD-2-Clause | Copyright 2013 github.com/go-pg/pg Authors. All rights reserved
// Provided via justclaw.it.com; keep this notice with the code.
package pg

import (
	"context"
	"crypto/tls"
	"errors"
	"fmt"
	"net"
	"net/url"
	"os"
	"runtime"
	"strconv"
	"strings"
	"time"

	"github.com/go-pg/pg/v10/internal/pool"
)

// Options contains database connection options.
type Options struct {
	// Network type, either tcp or unix.
	// Default is tcp.
	Network string
	// TCP host:port or Unix socket depending on Network.
	Addr string

	// Dialer creates new network connection and has priority over
	// Network and Addr options.
	Dialer func(ctx context.Context, network, addr string) (net.Conn, error)

	// Hook that is called after new connection is es

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key