| 102 | } |
| 103 | |
| 104 | func getColumnData(ctx context.Context, db *sqlx.DB, queueName string) (map[string]struct{}, error) { |
| 105 | rows, err := db.QueryContext(ctx, columnSelect, queueName) |
| 106 | if err != nil { |
| 107 | return nil, errors.Wrap(err, "querying schema of queue table") |
| 108 | } |
| 109 | defer func() { _ = rows.Close() }() |
| 110 | |
| 111 | columns := make(map[string]struct{}) |
| 112 | for rows.Next() { |
| 113 | var s string |
| 114 | if err := rows.Scan(&s); err != nil { |
| 115 | return nil, errors.Wrap(err, "reading schema row of queue table") |
| 116 | } |
| 117 | columns[s] = struct{}{} |
| 118 | } |
| 119 | if err := rows.Err(); err != nil { |
| 120 | return nil, errors.Wrap(err, "reading schema of queue table") |
| 121 | } |
| 122 | return columns, nil |
| 123 | } |
| 124 | |
| 125 | func checkIndexData(ctx context.Context, db *sqlx.DB, queueName string) (bool, error) { |
| 126 | rows, err := db.QueryContext(ctx, indexSelect, queueName, mandatoryIndexes) |