Build fully operational Frontend
This commit is contained in:
@@ -482,8 +482,8 @@ func makeDefaultDialer() *net.Dialer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func makeDefaultBuildFrontendFunc() BuildFrontendFunc {
|
func makeDefaultBuildFrontendFunc() BuildFrontendFunc {
|
||||||
return func(r io.Reader) Frontend {
|
return func(r io.Reader, w io.Writer) Frontend {
|
||||||
frontend, _ := pgproto3.NewFrontend(pgproto3.NewChunkReader(r), nil)
|
frontend, _ := pgproto3.NewFrontend(pgproto3.NewChunkReader(r), w)
|
||||||
|
|
||||||
return frontend
|
return frontend
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ type Notification struct {
|
|||||||
type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)
|
type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)
|
||||||
|
|
||||||
// BuildFrontendFunc is a function that can be used to create Frontend implementation for connection.
|
// BuildFrontendFunc is a function that can be used to create Frontend implementation for connection.
|
||||||
type BuildFrontendFunc func(r io.Reader) Frontend
|
type BuildFrontendFunc func(r io.Reader, w io.Writer) Frontend
|
||||||
|
|
||||||
// NoticeHandler is a function that can handle notices received from the PostgreSQL server. Notices can be received at
|
// NoticeHandler is a function that can handle notices received from the PostgreSQL server. Notices can be received at
|
||||||
// any time, usually during handling of a query response. The *PgConn is provided so the handler is aware of the origin
|
// any time, usually during handling of a query response. The *PgConn is provided so the handler is aware of the origin
|
||||||
@@ -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.BuildFrontend(pgConn.conn)
|
pgConn.frontend = config.BuildFrontend(pgConn.conn, pgConn.conn)
|
||||||
|
|
||||||
startupMsg := pgproto3.StartupMessage{
|
startupMsg := pgproto3.StartupMessage{
|
||||||
ProtocolVersion: pgproto3.ProtocolVersionNumber,
|
ProtocolVersion: pgproto3.ProtocolVersionNumber,
|
||||||
|
|||||||
Reference in New Issue
Block a user