(ctx context.Context, data []byte)
| 540 | } |
| 541 | |
| 542 | func (s *PostgresStore) persistConfig(ctx context.Context, data []byte) error { |
| 543 | query := fmt.Sprintf(` |
| 544 | INSERT INTO %s (id, content, created_at, updated_at) |
| 545 | VALUES ($1, $2, NOW(), NOW()) |
| 546 | ON CONFLICT (id) |
| 547 | DO UPDATE SET content = EXCLUDED.content, updated_at = NOW() |
| 548 | `, s.fullTableName(s.cfg.ConfigTable)) |
| 549 | normalized := normalizeLineEndings(string(data)) |
| 550 | if _, err := s.db.ExecContext(ctx, query, defaultConfigKey, normalized); err != nil { |
| 551 | return fmt.Errorf("postgres store: upsert config: %w", err) |
| 552 | } |
| 553 | return nil |
| 554 | } |
| 555 | |
| 556 | func (s *PostgresStore) deleteConfigRecord(ctx context.Context) error { |
| 557 | query := fmt.Sprintf("DELETE FROM %s WHERE id = $1", s.fullTableName(s.cfg.ConfigTable)) |
no test coverage detected