Skip to content

Add FUNCTION tag support for index expressions#7742

Open
destinyoooo wants to merge 1 commit intogo-gorm:masterfrom
destinyoooo:add_tag_function
Open

Add FUNCTION tag support for index expressions#7742
destinyoooo wants to merge 1 commit intogo-gorm:masterfrom
destinyoooo:add_tag_function

Conversation

@destinyoooo
Copy link
Copy Markdown

@destinyoooo destinyoooo commented Mar 27, 2026

What did this pull request do?

Add FUNCTION tag support to simplify functional index creation
resolve #7700

User Case Description

  • Added comprehensive unit tests covering single and multi-parameter function scenarios
  • Verified EXPRESSION tag priority
  • All existing tests continue to pass

@propel-code-bot
Copy link
Copy Markdown
Contributor

propel-code-bot Bot commented Mar 27, 2026

Add FUNCTION tag parsing for index expressions with tests

This PR introduces support for a FUNCTION tag in index definitions to automatically build index expressions from function names and parameters when EXPRESSION is not provided. It adds unit tests to validate single- and multi-parameter functions, empty-parameter handling, and precedence of EXPRESSION over FUNCTION.

Key Changes

• Added FUNCTION tag parsing in parseFieldIndexes to synthesize EXPRESSION values from function names and parameters
• Filtered out empty parameters when building function expressions to avoid malformed SQL
• Added tests in schema/index_function_test.go for multiple function scenarios and EXPRESSION precedence

Affected Areas

schema/index.go
schema/index_function_test.go
Schema.ParseIndexes() behavior via parseFieldIndexes

This summary was automatically generated by @propel-code-bot

propel-code-bot[bot]

This comment was marked as outdated.

@propel-code-bot propel-code-bot Bot changed the title feat: Add tag function to index Add FUNCTION tag support for index expressions Mar 27, 2026
propel-code-bot[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot Bot left a comment

Choose a reason for hiding this comment

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

No issues found; changes look solid and tests cover key scenarios.

Status: No Issues Found | Risk: Low

Review Details

📁 2 files reviewed | 💬 0 comments

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.

add tag function to (unique)index

1 participant