(ctx context.Context, relID string, data []byte)
| 518 | } |
| 519 | |
| 520 | func (s *PostgresStore) persistAuth(ctx context.Context, relID string, data []byte) error { |
| 521 | jsonPayload := json.RawMessage(data) |
| 522 | query := fmt.Sprintf(` |
| 523 | INSERT INTO %s (id, content, created_at, updated_at) |
| 524 | VALUES ($1, $2, NOW(), NOW()) |
| 525 | ON CONFLICT (id) |
| 526 | DO UPDATE SET content = EXCLUDED.content, updated_at = NOW() |
| 527 | `, s.fullTableName(s.cfg.AuthTable)) |
| 528 | if _, err := s.db.ExecContext(ctx, query, relID, jsonPayload); err != nil { |
| 529 | return fmt.Errorf("postgres store: upsert auth record: %w", err) |
| 530 | } |
| 531 | return nil |
| 532 | } |
| 533 | |
| 534 | func (s *PostgresStore) deleteAuthRecord(ctx context.Context, relID string) error { |
| 535 | query := fmt.Sprintf("DELETE FROM %s WHERE id = $1", s.fullTableName(s.cfg.AuthTable)) |
no test coverage detected