linter cleanup

This commit is contained in:
Todd Gruben 2021-09-13 14:16:20 -05:00
parent 95dc4a1a50
commit 419d1ed05d
3 changed files with 22 additions and 8 deletions

View file

@ -172,11 +172,13 @@ func (e *Encoder) i32(i int32) error {
return err
}
/* removed for linter now
func (e *Encoder) u32(i uint32) error {
binary.BigEndian.PutUint32(e.scratch[:], i)
_, err := e.buf.Write(e.scratch[:])
return err
}
*/
// ReadyForQuery encodes a "ready for query" message.
func (e *Encoder) ReadyForQuery(status TransactionStatus) (Message, error) {

View file

@ -30,6 +30,9 @@ type HandlerFunc func(context.Context, pg.QueryResultWriter, pg.Query) error
func (h HandlerFunc) HandleQuery(ctx context.Context, w pg.QueryResultWriter, q pg.Query) error {
return h(ctx, w, q)
}
func (h HandlerFunc) HandleSchema(ctx context.Context, portal *pg.Portal) error {
return nil
}
var _ pg.QueryHandler = HandlerFunc(nil)

View file

@ -273,12 +273,12 @@ const (
)
type Portal struct {
Name string
Writer *message.WireWriter
commands []message.Message
Encoder *message.Encoder
mapper *sql.Mapper
results []Result
Name string
Writer *message.WireWriter
commands []message.Message
Encoder *message.Encoder
mapper *sql.Mapper
//results []Result
sql string
pgspecial PgType
pid int32
@ -491,7 +491,11 @@ func (p *Portal) Execute() (shouldTerminate bool, queryReady bool) {
// need to return something so that the id can be queried
//need to return SELECT pid as id, query as stmt, EXTRACT(seconds from query_start - NOW()) as elapsed_time FROM pg_stat_activity
//seems like we need a map of pids to querys
p.server.dumpPortalsTo(p)
err := p.server.dumpPortalsTo(p)
if err != nil {
return
}
case pgTerminate:
//note just have 1 lock that blocks all who try to count the activities
vprint.VV("removing the block ")
@ -577,7 +581,12 @@ func (p *Portal) Execute() (shouldTerminate bool, queryReady bool) {
func (p *Portal) Sync() {
for _, m := range p.commands {
vprint.VV("Sending: '%v'", m.Type)
p.Writer.WriteMessage(m)
err := p.Writer.WriteMessage(m)
if err != nil {
//TODO (twg) need to change signature to return error
vprint.VV("error %v", err)
return
}
}
p.Writer.Flush()
p.Reset()