func (c *Conn) sortSelectResult(r *mysql.Resultset, stmt *sqlparser.Select) error { if stmt.OrderBy == nil { return nil } sk := make([]mysql.SortKey, len(stmt.OrderBy)) for i, o := range stmt.OrderBy { sk[i].Name = nstring(o.Expr, c.alloc) sk[i].Direction = o.Direction } return r.Sort(sk) }