Skip to content

Conversation

@pseudomuto
Copy link
Owner

Replace switch statements with slice-based lookups for better maintainability and consistency. Adds supportedOperations slice to each driver following the same pattern as supportedFeatures.

Replace switch statements with slice-based lookups for better maintainability
and consistency. Adds supportedOperations slice to each driver following
the same pattern as supportedFeatures.
@pseudomuto pseudomuto requested a review from Copilot October 15, 2025 11:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the TranslateOperator method across PostgreSQL, MySQL, and ClickHouse drivers by replacing verbose switch statements with slice-based lookups. The change introduces a supportedOperations slice in each driver, following the same pattern as the existing supportedFeatures slice. Additionally, fixes an inconsistent variable naming issue in the ClickHouse driver (supportsFeaturessupportedFeatures).

  • Introduces supportedOperations slice in each driver for cleaner operator validation
  • Simplifies TranslateOperator logic using slices.Contains instead of switch cases
  • Fixes variable naming inconsistency in ClickHouse driver

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
drivers/postgres/postgres.go Adds supportedOperations slice and refactors TranslateOperator to use slice-based lookup
drivers/mysql/mysql.go Adds supportedOperations slice, refactors TranslateOperator, and extracts ILIKE handling into separate condition
drivers/clickhouse/clickhouse.go Adds supportedOperations slice, refactors TranslateOperator, and fixes supportsFeatures typo to supportedFeatures

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pseudomuto pseudomuto merged commit c2a681d into main Oct 15, 2025
3 checks passed
@pseudomuto pseudomuto deleted the simplify_translate_operator branch October 15, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants