MCPcopy Create free account
hub / github.com/dataddo/pgq / checkIndexData

Function checkIndexData

validator.go:125–145  ·  view source on GitHub ↗
(ctx context.Context, db *sqlx.DB, queueName string)

Source from the content-addressed store, hash-verified

123}
124
125func 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}

Callers 1

ValidateIndexesFunction · 0.85

Calls 1

NextMethod · 0.80

Tested by

no test coverage detected