MCPcopy Create free account
hub / github.com/Permify/permify / getCurrentPostgreXID

Method getCurrentPostgreXID

pkg/database/postgres/repair.go:113–120  ·  view source on GitHub ↗

getCurrentPostgreSQLXID gets the current PostgreSQL transaction ID

(ctx context.Context)

Source from the content-addressed store, hash-verified

111
112// getCurrentPostgreSQLXID gets the current PostgreSQL transaction ID
113func (p *Postgres) getCurrentPostgreXID(ctx context.Context) (uint64, error) {
114 var x int64
115 query := "SELECT COALESCE(pg_current_xact_id()::text, '0')::bigint"
116 if err := p.ReadPool.QueryRow(ctx, query).Scan(&x); err != nil {
117 return 0, err
118 }
119 return uint64(x), nil
120}
121
122// getMaxReferencedXID gets the maximum transaction ID referenced in the transactions table
123func (p *Postgres) getMaxReferencedXID(ctx context.Context) (uint64, error) {

Callers 2

RepairMethod · 0.95
repair_test.goFile · 0.80

Calls 1

ScanMethod · 0.45

Tested by

no test coverage detected