2
0

Build fully operational Frontend

This commit is contained in:
Jack Christensen
2019-08-24 23:57:24 -05:00
parent 6feea0c1c5
commit 595d09d6f1
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -482,8 +482,8 @@ func makeDefaultDialer() *net.Dialer {
}
func makeDefaultBuildFrontendFunc() BuildFrontendFunc {
return func(r io.Reader) Frontend {
frontend, _ := pgproto3.NewFrontend(pgproto3.NewChunkReader(r), nil)
return func(r io.Reader, w io.Writer) Frontend {
frontend, _ := pgproto3.NewFrontend(pgproto3.NewChunkReader(r), w)
return frontend
}
+2 -2
View File
@@ -44,7 +44,7 @@ type Notification struct {
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.
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
// 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{}) },
)
pgConn.frontend = config.BuildFrontend(pgConn.conn)
pgConn.frontend = config.BuildFrontend(pgConn.conn, pgConn.conn)
startupMsg := pgproto3.StartupMessage{
ProtocolVersion: pgproto3.ProtocolVersionNumber,