Skip to content

Conversation

@lingcoder
Copy link
Contributor

Summary

  • Add wildcard pattern support (* and ?) for tables configuration
  • Fix tablesEx wildcard to use exact match (^$) for consistency
  • Add warning when exact table name does not exist
  • Add unit tests and integration tests for MySQL and PostgreSQL

Changes

Configuration Before After
tables: "user_*" Not supported Matches tables starting with "user_"
tables: "*" Not supported Matches all tables
tablesEx: "user_*" Partial match Exact match (consistent with tables)

Features

  • * matches any characters (e.g., user_* matches user_info, user_log)
  • ? matches single character (e.g., user_??? matches user_log but not user_info)
  • Mixed patterns and exact names supported (e.g., tables: "user_*,config")
  • Non-existent exact table names are skipped with warning message

Test plan

  • Unit tests for containsWildcard, patternToRegex, filterTablesByPatterns (11 cases)
  • Integration tests for MySQL (5 cases)
  • Integration tests for PostgreSQL (1 case with tables + tablesEx)
  • Standard SQL syntax for cross-database compatibility

Closes #4629

lingcoder and others added 3 commits January 20, 2026 10:21
- Add wildcard pattern support (* and ?) for tables configuration
- Fix tablesEx wildcard to use exact match (^$) for consistency
- Add warning when exact table name does not exist
- Add unit tests and integration tests for MySQL and PostgreSQL

Changes:
- tables: "user_*" now matches all tables starting with "user_"
- tables: "*" matches all tables
- tablesEx: "user_*" now uses exact match instead of partial match
- Non-existent exact table names are skipped with warning

Closes gogf#4629
…I table pollution

The test was using Tables: "*" which matches all tables in the database,
including tables from other tests. Changed to use specific patterns to
match only our test tables.
@CyJaySong
Copy link
Contributor

LGTM

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.

gf dao gen: 添加 tables pattern

2 participants