MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / persistAuth

Method persistAuth

internal/store/postgresstore.go:520–532  ·  view source on GitHub ↗
(ctx context.Context, relID string, data []byte)

Source from the content-addressed store, hash-verified

518}
519
520func (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
534func (s *PostgresStore) deleteAuthRecord(ctx context.Context, relID string) error {
535 query := fmt.Sprintf("DELETE FROM %s WHERE id = $1", s.fullTableName(s.cfg.AuthTable))

Callers 2

syncAuthFileMethod · 0.95
upsertAuthRecordMethod · 0.95

Calls 1

fullTableNameMethod · 0.95

Tested by

no test coverage detected