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

Function getColumnData

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

Source from the content-addressed store, hash-verified

102}
103
104func 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
125func checkIndexData(ctx context.Context, db *sqlx.DB, queueName string) (bool, error) {
126 rows, err := db.QueryContext(ctx, indexSelect, queueName, mandatoryIndexes)

Callers 1

ValidateFieldsFunction · 0.85

Calls 1

NextMethod · 0.80

Tested by

no test coverage detected