Rename BuildFrontendFunc to BuildFrontend
For consistency with other functions supplied in Config.
This commit is contained in:
@@ -29,15 +29,15 @@ type ValidateConnectFunc func(ctx context.Context, pgconn *PgConn) error
|
|||||||
// Config is the settings used to establish a connection to a PostgreSQL server. It must be created by ParseConfig and
|
// Config is the settings used to establish a connection to a PostgreSQL server. It must be created by ParseConfig and
|
||||||
// then it can be modified. A manually initialized Config will cause ConnectConfig to panic.
|
// then it can be modified. A manually initialized Config will cause ConnectConfig to panic.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string // host (e.g. localhost) or path to unix domain socket directory (e.g. /private/tmp)
|
Host string // host (e.g. localhost) or path to unix domain socket directory (e.g. /private/tmp)
|
||||||
Port uint16
|
Port uint16
|
||||||
Database string
|
Database string
|
||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
TLSConfig *tls.Config // nil disables TLS
|
TLSConfig *tls.Config // nil disables TLS
|
||||||
DialFunc DialFunc // e.g. net.Dialer.DialContext
|
DialFunc DialFunc // e.g. net.Dialer.DialContext
|
||||||
BuildFrontendFunc BuildFrontendFunc
|
BuildFrontend BuildFrontendFunc
|
||||||
RuntimeParams map[string]string // Run-time parameters to set on connection as session default values (e.g. search_path or application_name)
|
RuntimeParams map[string]string // Run-time parameters to set on connection as session default values (e.g. search_path or application_name)
|
||||||
|
|
||||||
Fallbacks []*FallbackConfig
|
Fallbacks []*FallbackConfig
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ func ParseConfig(connString string) (*Config, error) {
|
|||||||
User: settings["user"],
|
User: settings["user"],
|
||||||
Password: settings["password"],
|
Password: settings["password"],
|
||||||
RuntimeParams: make(map[string]string),
|
RuntimeParams: make(map[string]string),
|
||||||
BuildFrontendFunc: makeDefaultBuildFrontendFunc(),
|
BuildFrontend: makeDefaultBuildFrontendFunc(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if connectTimeout, present := settings["connect_timeout"]; present {
|
if connectTimeout, present := settings["connect_timeout"]; present {
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ func connect(ctx context.Context, config *Config, fallbackConfig *FallbackConfig
|
|||||||
func() { pgConn.conn.SetDeadline(time.Time{}) },
|
func() { pgConn.conn.SetDeadline(time.Time{}) },
|
||||||
)
|
)
|
||||||
|
|
||||||
pgConn.frontend = config.BuildFrontendFunc(pgConn.conn)
|
pgConn.frontend = config.BuildFrontend(pgConn.conn)
|
||||||
|
|
||||||
startupMsg := pgproto3.StartupMessage{
|
startupMsg := pgproto3.StartupMessage{
|
||||||
ProtocolVersion: pgproto3.ProtocolVersionNumber,
|
ProtocolVersion: pgproto3.ProtocolVersionNumber,
|
||||||
|
|||||||
Reference in New Issue
Block a user