PGLocks returns a list of all locks in the database currently in use.
(ctx context.Context)
| 71 | |
| 72 | // PGLocks returns a list of all locks in the database currently in use. |
| 73 | func (q *sqlQuerier) PGLocks(ctx context.Context) (PGLocks, error) { |
| 74 | rows, err := q.sdb.QueryContext(ctx, ` |
| 75 | SELECT |
| 76 | relation::regclass AS relation_name, |
| 77 | * |
| 78 | FROM pg_locks; |
| 79 | `) |
| 80 | if err != nil { |
| 81 | return nil, err |
| 82 | } |
| 83 | |
| 84 | defer rows.Close() |
| 85 | |
| 86 | var locks []PGLock |
| 87 | err = sqlx.StructScan(rows, &locks) |
| 88 | if err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | |
| 92 | return locks, err |
| 93 | } |
| 94 | |
| 95 | type PGLocks []PGLock |
| 96 |
nothing calls this directly
no test coverage detected