MCPcopy Index your code
hub / github.com/coder/coder / PGLocks

Method PGLocks

coderd/database/pglocks.go:73–93  ·  view source on GitHub ↗

PGLocks returns a list of all locks in the database currently in use.

(ctx context.Context)

Source from the content-addressed store, hash-verified

71
72// PGLocks returns a list of all locks in the database currently in use.
73func (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
95type PGLocks []PGLock
96

Callers

nothing calls this directly

Calls 2

QueryContextMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected