| 123 | } |
| 124 | |
| 125 | func checkIndexData(ctx context.Context, db *sqlx.DB, queueName string) (bool, error) { |
| 126 | rows, err := db.QueryContext(ctx, indexSelect, queueName, mandatoryIndexes) |
| 127 | if err != nil { |
| 128 | return false, errors.Wrap(err, "querying index schema of queue table") |
| 129 | } |
| 130 | defer func() { _ = rows.Close() }() |
| 131 | |
| 132 | var allMandatoryColumnsAreIndexed bool |
| 133 | for rows.Next() { |
| 134 | if err := rows.Scan(&allMandatoryColumnsAreIndexed); err != nil { |
| 135 | return false, errors.Wrap(err, "reading index schema row of queue table") |
| 136 | } |
| 137 | } |
| 138 | if err := rows.Err(); err != nil { |
| 139 | return false, errors.Wrap(err, "reading index schema of queue table") |
| 140 | } |
| 141 | if err := rows.Close(); err != nil { |
| 142 | return false, errors.Wrap(err, "closing index schema query of queue table") |
| 143 | } |
| 144 | return allMandatoryColumnsAreIndexed, nil |
| 145 | } |