## 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
- [x] Unit tests for `containsWildcard`, `patternToRegex`,
`filterTablesByPatterns` (11 cases)
- [x] Integration tests for MySQL (5 cases)
- [x] Integration tests for PostgreSQL (1 case with tables + tablesEx)
- [x] Standard SQL syntax for cross-database compatibility
Closes#4629
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
## Summary
- Fix `gf env` and `gf build --dumpEnv` command failing when `go env`
outputs warning messages
- When `go env` outputs warnings (e.g., invalid characters in
environment variables), it returns non-zero exit code but still provides
valid output
- The original code would fail in this case
## Changes
- Only fail when `go env` returns empty output, allow non-zero exit code
with valid output
- Skip lines that don't match `key=value` format instead of failing with
Fatal error
- Add debug log for skipped lines to help troubleshooting
- Add unit tests for env command
## Related Issue
Fixes#4469
## Test plan
- [x] `gf env` command works correctly even when `go env` outputs
warnings
- [x] `gf build --dumpEnv` works correctly
- [x] Added unit tests pass
## Summary
- Fix `gf gen enums` output file created at wrong location when using
relative path
- Output was incorrectly relative to source directory instead of current
working directory
- Add `defer gfile.Chdir(originPwd)` to restore original working
directory
## Root Cause
The code calls `gfile.Chdir(realPath)` to change to source directory
before `gfile.PutContents(in.Path, ...)`, causing relative output path
to be resolved relative to source directory.
## Solution
- Convert output path to absolute using `gfile.Abs()` before `Chdir`
- Restore original working directory with `defer` (following `genpb.go`
pattern)
## Test Cases
- `Test_Gen_Enums_Issue4387_RelativePath` - standard project with
relative path
- `Test_Gen_Enums_AbsolutePath` - absolute path (should work as before)
- `Test_Gen_Enums_Issue4387_Monorepo` - monorepo mode (`cd app/xxx && gf
gen enums`)
Closes#4387
## Summary
- Fix overlapping shardingPattern matching issue where shorter patterns
incorrectly match tables meant for longer patterns
- Sort shardingPattern by length descending so longer (more specific)
patterns are matched first
- Add break after successful pattern match to prevent tables from
matching multiple patterns
## Problem
When `shardingPattern` contains overlapping prefixes like `["a_?",
"a_b_?", "a_c_?"]`:
- Tables `a_b_1`, `a_b_2` should match `a_b_?` and generate `a_b.go`
- Tables `a_c_1`, `a_c_2` should match `a_c_?` and generate `a_c.go`
- Tables `a_1`, `a_2` should match `a_?` and generate `a.go`
But without this fix, `a_?` (converted to regex `a_(.+)`) would match
`a_b_1` first, causing `a_b_?` and `a_c_?` patterns to fail to generate
their respective dao files.
## Solution
1. Sort `shardingPattern` by length descending before matching
2. Add `break` after a table matches a pattern to prevent multiple
matches
## Test plan
- [x] Added integration test `Test_Gen_Dao_Sharding_Overlapping` with
overlapping patterns
- [x] Added SQL test data file `sharding_overlapping.sql`
- [x] Verified 3 separate dao files are generated: `a.go`, `a_b.go`,
`a_c.go`
Fixes#4603
## Summary
- Add 2 new integration test cases for `gf gen service` command
- `Test_Gen_Service_CamelCase`: tests `DstFileNameCase: "Camel"` option
to generate service files with CamelCase naming
- `Test_Gen_Service_PackagesFilter`: tests `Packages` filter option to
generate service files only for specified packages
## Test Plan
- [x] Run `go test -v -run "Test_Gen_Service" ./...` - all 5 tests pass
(3 existing + 2 new)
## Summary
- Add 2 new integration test cases for `gf gen pb` command
- `TestGenPb_MultipleTags`: tests multiple validation tags (v:required,
v:#Id > 0, v:email) and dc tags
- `TestGenPb_NestedMessage`: tests nested message structures with
various tag types
## Test Data
- Add `testdata/genpb/multiple_tags.proto` - proto file with multiple
tag annotations
- Add `testdata/genpb/nested_message.proto` - proto file with nested
message structures
## Test Plan
- [x] Run `go test -v -run "TestGenPb" ./...` - all 4 tests pass (2
existing + 2 new)
## Summary
- Enhance unit tests for the `fix` command's `doFixV25Content` function
- 5 new test cases added (total: 6)
## New Test Cases
| Test | Description |
|------|-------------|
| Test_Fix_doFixV25Content_WithReplacement | Verify actual replacement
is made |
| Test_Fix_doFixV25Content_NoMatch | Handle content without patterns |
| Test_Fix_doFixV25Content_MultipleMatches | Handle multiple occurrences
|
| Test_Fix_doFixV25Content_EmptyContent | Handle empty content |
| Test_Fix_doFixV25Content_ComplexPath | Handle complex URL paths |
## Test plan
- [x] All 6 tests pass locally
- [x] Only added new test cases to existing test file
- [x] No modifications to non-test code
## Summary
- Add comprehensive unit tests for the `genenums` package which handles
enum parsing and JSON export
- 13 new test cases covering core functionality
## Test Coverage
| Function | Tests | Description |
|----------|-------|-------------|
| `NewEnumsParser` | 2 | Parser initialization |
| `Export` | 7 | JSON export with various types |
| `ParsePackages` | 2 | Integration with Go packages |
| `EnumItem` | 1 | Data structure |
| `getStandardPackages` | 1 | Standard library detection |
## Test plan
- [x] All 13 tests pass locally
- [x] No modifications to existing code
- [x] New test file only: `genenums_z_unit_test.go`
This pull request refactors the way Go files are formatted after project
generation in the `geninit` package. The main change is replacing the
previous formatting utility with a new function that uses the standard
library's `go/format` package, ensuring that only code formatting is
applied and import paths are not inadvertently modified.
**Formatting improvements:**
* Replaced the use of `utils.GoFmt` with a new `formatGoFiles` function
that utilizes `go/format` for formatting Go files, avoiding unwanted
changes to local import paths.
(`cmd/gf/internal/cmd/geninit/geninit_generator.go`)
* Added the `formatGoFiles` function, which recursively formats all Go
files in a directory using `go/format` and logs any formatting errors.
(`cmd/gf/internal/cmd/geninit/geninit_generator.go`)
* Updated comments and references in the code to clarify that formatting
is now handled by `formatGoFiles` instead of `utils.GoFmt`.
(`cmd/gf/internal/cmd/geninit/geninit_ast.go`)
**Dependency changes:**
* Removed the import of the custom `utils` package and added the
standard `go/format` package to support the new formatting approach.
(`cmd/gf/internal/cmd/geninit/geninit_generator.go`)
This pull request primarily updates the GoFrame (`gf`) framework and its
related driver dependencies from version `v2.9.6` to `v2.9.7` across the
repository. Additionally, it removes the `examples` submodule and
updates the contributors image in the `README.MD` to reflect the new
version.
Dependency updates:
* Updated all references to `github.com/gogf/gf/v2` and related driver
dependencies from `v2.9.6` to `v2.9.7` in various `go.mod` files
throughout the repository, including core modules and contributed
drivers/configs.
[[1]](diffhunk://#diff-ee0abb9c50b9f91f424349123e31b7b1ba1e1e4f7497250422696c5bda2e74ceL6-R12)
[[2]](diffhunk://#diff-cef597d401b6dad225f9e2e431bdde7e53cb60bdf287624cef38a6a7bb9ae7a3L7-R7)
[[3]](diffhunk://#diff-970f7eacff9cd97a0d8a00d59ea8041eedaa21c7544c6669aaa58ca692c6b274L6-R6)
[[4]](diffhunk://#diff-c23d0ca80cd6588b7df84de8ef84713f0ce0555ba05d2d9e7f5d1e0324b1ed3aL6-R6)
[[5]](diffhunk://#diff-aa230a2b1198e6ef8afeb7f48335eb2e2f51d87d918d63c4d891fea612d18ff0L6-R6)
[[6]](diffhunk://#diff-86c2390edbede20803cd862908fe95e7207f7dbabd5089ddd4838e1f26e7fecaL6-R6)
[[7]](diffhunk://#diff-5e1af33d38ced461fc0e13981d7051e125876d1692efc3aa9cb4b7faa4c18addL7-R7)
[[8]](diffhunk://#diff-8c6247829130f219981483ccf25af699a63de99afedeb0dd5c1b7bd8ff0919bdL9-R9)
[[9]](diffhunk://#diff-accbd2d37d45e51db3fcb0468043b1e1fd53eeac9e3d3558467ef24444188d2fL7-R7)
[[10]](diffhunk://#diff-15fac9b8e76d2782594c91da72f6a6f42fc18e359c3be35bf6564ac3ca09f700L6-R7)
[[11]](diffhunk://#diff-8e1a76afd564b6073aac7b02ca59f296ae45a24da3dc4d5c40f18169f48ceba1L6-R6)
[[12]](diffhunk://#diff-00a9db26966c21305c72e8f659628dffaff0d6e9dc98a751406d2141d51a5d90L7-R7)
[[13]](diffhunk://#diff-2cbf2f66d5cb77d9f4d00e4c0ce45055620fff50c941a588da31729f09a81f1bL6-R7)
[[14]](diffhunk://#diff-20a21d07addeea398c4adb76d077875894a73b4b5b181b9df1fafe497d3fc843L6-R6)
[[15]](diffhunk://#diff-909670f1c29b0bba24faf1420504b9eacdff124c4cbbec1ddec5de60653ad007L6-R6)
[[16]](diffhunk://#diff-8eef5f0c081743f8002e0faba686e838b323cb53b749706ea42e0440aaa793f1L7-R7)
[[17]](diffhunk://#diff-82345842a29e8eaffa4f51aab96fa2aa78597e6639fe4b0ece797bc60edacea8L6-R6)
[[18]](diffhunk://#diff-23c6a84d45f3b30ae7ab1a95dec0b30329e702923cc74c5344b3606237ddd929L6-R7)
Repository maintenance:
* Removed the `examples` submodule entry from `.gitmodules`, indicating
that the examples are no longer included as a submodule in the
repository.
Documentation update:
* Updated the contributors image in `README.MD` to reference version
`v2.9.7` instead of `v2.9.6`.
This pull request introduces a significant enhancement to the `gf run`
command, focusing on improving the directory watching mechanism for
hot-reload functionality. The main improvements include a more
intelligent and efficient algorithm for determining which directories to
watch (recursively or non-recursively), support for custom ignore
patterns, and a comprehensive set of unit tests to ensure correctness.
Additionally, some outdated database drivers were removed from the
dependencies.
**Key changes:**
### Directory Watching Improvements
* Refactored the directory watching logic in `cmd_run.go` to use a
DFS-based algorithm that minimizes the number of watched directories
while respecting ignored patterns. Directories and their descendants
without ignored subdirectories are watched recursively; otherwise,
non-recursive watches are set, and valid children are recursed into.
This results in more efficient and accurate hot-reload behavior.
(`cmd/gf/internal/cmd/cmd_run.go`)
* Added support for custom ignore patterns via the new
`-i`/`--ignorePatterns` flag, allowing users to specify directories to
be excluded from watching. Default ignored patterns include
`node_modules`, `vendor`, hidden directories, and directories starting
with an underscore. (`cmd/gf/internal/cmd/cmd_run.go`)
[[1]](diffhunk://#diff-406a97355fde87f9a6fc118877430c2720632eb94eb2aaba72025571e5fe5146R97)
[[2]](diffhunk://#diff-406a97355fde87f9a6fc118877430c2720632eb94eb2aaba72025571e5fe5146L61-R69)
[[3]](diffhunk://#diff-406a97355fde87f9a6fc118877430c2720632eb94eb2aaba72025571e5fe5146L104-R132)
* Improved parsing of comma-separated arguments for both watch paths and
ignore patterns to support flexible CLI usage.
(`cmd/gf/internal/cmd/cmd_run.go`)
### User Experience and Documentation
* Updated help messages, usage examples, and documentation to reflect
the new features and more intuitive CLI options for specifying watch
paths and ignore patterns. (`cmd/gf/internal/cmd/cmd_run.go`)
[[1]](diffhunk://#diff-406a97355fde87f9a6fc118877430c2720632eb94eb2aaba72025571e5fe5146L51-R58)
[[2]](diffhunk://#diff-406a97355fde87f9a6fc118877430c2720632eb94eb2aaba72025571e5fe5146R85)
### Testing
* Added a comprehensive unit test suite for the new `getWatchPaths`
logic, covering various scenarios including custom ignore patterns,
deeply nested structures, multiple roots, non-existent directories, and
edge cases. (`cmd/gf/internal/cmd/cmd_z_unit_run_test.go`)
### Dependency Cleanup
* Removed unused database driver dependencies from `go.mod` to
streamline the project dependencies. (`cmd/gf/go.mod`)
These changes collectively make the hot-reload feature more robust,
configurable, and efficient, while ensuring maintainability through
thorough testing.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: houseme <housemecn@gmail.com>
This pull request introduces a significant enhancement to the `gf init`
command by adding support for initializing GoFrame projects from remote
templates, including interactive and advanced options for template
selection. The changes include new interactive flows, support for remote
repositories (including git subdirectories), and modularization of the
template initialization logic into a new `geninit` package.
The most important changes are:
### New Features & Interactive Initialization
* Added support for initializing projects from remote templates via the
`--repo/-r` flag, interactive mode (`--interactive/-i`), and version
selection (`--select/-s`). Users can now select built-in or remote
templates, specify custom repositories, and interactively choose project
configuration. (`cmd/gf/internal/cmd/cmd_init.go`)
[[1]](diffhunk://#diff-1213f1d7ea9ec0979d1b7aafaf9c84d53846c95f541e0252ab976cca90c677bdR50-R55)
[[2]](diffhunk://#diff-1213f1d7ea9ec0979d1b7aafaf9c84d53846c95f541e0252ab976cca90c677bdL68-R161)
[[3]](diffhunk://#diff-1213f1d7ea9ec0979d1b7aafaf9c84d53846c95f541e0252ab976cca90c677bdR267-R398)
* Introduced interactive prompts for template and project configuration,
including project name, module path, and dependency upgrade options.
(`cmd/gf/internal/cmd/cmd_init.go`)
### Code Organization & Modularization
* Extracted remote template initialization logic into a new package,
`geninit`, with a clear API for processing templates, handling
Go/gomod/git environments, and managing project generation.
(`cmd/gf/internal/cmd/geninit/geninit.go`)
* Added helper modules for Go and Git environment checks
(`geninit_env.go`), template downloading (`geninit_downloader.go`), and
AST-based Go import path replacement (`geninit_ast.go`).
[[1]](diffhunk://#diff-6238f52cc62f1e0dd569c7b1eacec609337e6e9eb9faf8604dcfc82149d907d1R1-R90)
[[2]](diffhunk://#diff-bbc29bf9a77f7097721185062041ff8ef622176bfb2c3886a94e68485773b5e6R1-R99)
[[3]](diffhunk://#diff-269925976ae0929279513615dbafc06f8560859ff0830ce82702735a5a7d6c61R1-R127)
### Usability Improvements
* Updated help and usage documentation to reflect new flags and
initialization modes, making it easier for users to discover and use the
new features. (`cmd/gf/internal/cmd/cmd_init.go`)
These changes greatly improve the flexibility and user experience of
project initialization in GoFrame, enabling both simple and advanced
workflows.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixed: #4113
when use "removeFieldPrefix" config to generate entity, also delete
prefix in json tag
Co-authored-by: zhang <zhangtao@changxinsec.com>
Co-authored-by: hailaz <739476267@qq.com>
This pull request adds first-class support for MariaDB, TiDB, OceanBase,
and GaussDB as separate database drivers in the GoFrame ecosystem,
rather than relying solely on MySQL compatibility. It introduces new
driver packages for each database, updates documentation to reflect
these additions, and adjusts dependency management files accordingly.
The changes also deprecate the MariaDB-specific logic in the MySQL
driver in favor of the new dedicated MariaDB driver.
**New Database Driver Support**
* Added new driver packages for MariaDB, TiDB, OceanBase, and GaussDB
under `contrib/drivers/`, each with their own Go module files and driver
implementation that wraps the MySQL driver for protocol compatibility
and future extensibility.
[[1]](diffhunk://#diff-0dd9dca0fb712c3691a95186853d1fc38a30a74ba34cbdc9aa6facee5457d681R1-R48)
[[2]](diffhunk://#diff-23c6a84d45f3b30ae7ab1a95dec0b30329e702923cc74c5344b3606237ddd929R1-R44)
[[3]](diffhunk://#diff-a8a6766c0d5b9c0788d0276b41b33fdbe786e0584fda19fd26db715bcf46fbcdR1-R48)
[[4]](diffhunk://#diff-2cbf2f66d5cb77d9f4d00e4c0ce45055620fff50c941a588da31729f09a81f1bR1-R44)
[[5]](diffhunk://#diff-4f0d2a9160a039ccdf1dc98205ed7cd9f3bb8d606fed57c5a4813937eecca81fR1-R47)
[[6]](diffhunk://#diff-accbd2d37d45e51db3fcb0468043b1e1fd53eeac9e3d3558467ef24444188d2fR1-R44)
[[7]](diffhunk://#diff-15fac9b8e76d2782594c91da72f6a6f42fc18e359c3be35bf6564ac3ca09f700R1-R44)
* Registered these new drivers in the main module's `go.mod` and
`go.work` files for proper dependency resolution and local development.
[[1]](diffhunk://#diff-ee0abb9c50b9f91f424349123e31b7b1ba1e1e4f7497250422696c5bda2e74ceR12-R15)
[[2]](diffhunk://#diff-a70c108de96ca9b56b7768254143b2b9f20ce1dcab51d92ce083fdfcba2efd6cR17-R20)
**Documentation Updates**
* Expanded the `contrib/drivers/README.MD` to include installation and
import instructions for the new drivers, and clarified the supported
drivers section with dedicated code examples for each.
[[1]](diffhunk://#diff-d49f5bc3a34b11a6ccb82cc54675b06a7dea5f0a943ae91c4ca0d28bd5003299R12-R24)
[[2]](diffhunk://#diff-d49f5bc3a34b11a6ccb82cc54675b06a7dea5f0a943ae91c4ca0d28bd5003299L46-R80)
**MariaDB Driver Enhancements**
* Implemented a MariaDB-specific `TableFields` method and SQL query in
the new driver, improving the accuracy of table field retrieval for
MariaDB databases.
* Added unit test initialization code for MariaDB to ensure driver
functionality.
**Deprecation and Refactoring**
* Marked the MariaDB-specific logic and SQL in the MySQL driver as
deprecated, with a note to remove it in the next version, directing
users to the new MariaDB driver instead.
[[1]](diffhunk://#diff-9892cdfb158af82d92f3bfe9e418011bd47a0596638428e61c70993dd72b9c47R18-R20)
[[2]](diffhunk://#diff-9892cdfb158af82d92f3bfe9e418011bd47a0596638428e61c70993dd72b9c47R74-R75)
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Lance Add <1196661499@qq.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This pull request introduces significant improvements to the handling of
the `Replace` and `Save` operations for multiple database drivers,
especially for MSSQL and PostgreSQL. The changes ensure that these
operations now auto-detect primary keys when conflict columns are not
explicitly provided, improving usability and aligning behavior across
drivers. Additionally, the pull request updates related tests to reflect
these enhancements and includes some minor documentation and code
cleanup.
**Key changes:**
### Enhanced Replace/Save Logic for Database Drivers
* **MSSQL Driver:**
- `Replace` and `Save` operations now auto-detect primary keys if
`OnConflict` is not specified, using the `MERGE` statement for upsert
functionality. If no primary key is found in the data, a detailed error
is returned.
[[1]](diffhunk://#diff-87815aa559a927e2de09bd05148f9841dfc06a1b5f3ecc5e3d5fcb80323a87f8L23-R61)
[[2]](diffhunk://#diff-87815aa559a927e2de09bd05148f9841dfc06a1b5f3ecc5e3d5fcb80323a87f8L43-L59)
- Updated tests to verify that `Replace` correctly updates or inserts
records, and that missing conflict columns are properly handled.
[[1]](diffhunk://#diff-bdbde9d7d6ee14c795343767b414740c4396f4dd3e97788b1f9d4e615405a42dL141-R151)
[[2]](diffhunk://#diff-26338e93e473300b1313936eb0f6826546473793442f24715fa294b595f7a805L2661-R2707)
* **PostgreSQL Driver:**
- Similar to MSSQL, `Replace` and `Save` now auto-detect primary keys
for conflict resolution if `OnConflict` is not set, and treat `Replace`
as a `Save` operation.
- Adjusted tests to ensure `Save` and `Replace` work as expected,
including verifying data replacement and insertion.
[[1]](diffhunk://#diff-c22703c37ebb6836c332f7cd2ada570577ba4564fe39886db02f7c2d0e7a2048L93-R93)
[[2]](diffhunk://#diff-c22703c37ebb6836c332f7cd2ada570577ba4564fe39886db02f7c2d0e7a2048R102)
[[3]](diffhunk://#diff-c22703c37ebb6836c332f7cd2ada570577ba4564fe39886db02f7c2d0e7a2048L110-R130)
* **DM Driver:**
- Improved conflict detection: now checks that at least one primary key
exists in the provided data when `OnConflict` is not specified, and
provides clearer error messages.
- Refactored to use the core method for primary key detection and
removed redundant code.
### Minor Improvements and Documentation
* Added clarifying comments to `DoInsert` methods for ClickHouse, DM,
MSSQL, Oracle, and PostgreSQL drivers, specifying that the input list
must have at least one validated record.
[[1]](diffhunk://#diff-f2e003895041ed3c52b91bb8c270696adc3528d77c39d2f7137af3396267444cR19)
[[2]](diffhunk://#diff-f51b30e3f0b0f1284b905385a89992efd0de2fe9ff8c5a4062344dfab17d428eR23)
[[3]](diffhunk://#diff-87815aa559a927e2de09bd05148f9841dfc06a1b5f3ecc5e3d5fcb80323a87f8L23-R61)
[[4]](diffhunk://#diff-f61dac3fcfd5df4a3936cd8743499c8c0fc45f4f5d0f5398ed84a0cb1603202cR24)
[[5]](diffhunk://#diff-c1dfed79aaa3a432057d2bd74d270e4b4094ebcf72984f1161d4972bea009410R16-R72)
* Minor code and comment cleanups, including improved formatting and
error handling.
[[1]](diffhunk://#diff-f61dac3fcfd5df4a3936cd8743499c8c0fc45f4f5d0f5398ed84a0cb1603202cR37)
[[2]](diffhunk://#diff-f61dac3fcfd5df4a3936cd8743499c8c0fc45f4f5d0f5398ed84a0cb1603202cL96-R98)
[[3]](diffhunk://#diff-f61dac3fcfd5df4a3936cd8743499c8c0fc45f4f5d0f5398ed84a0cb1603202cL106-L116)
[[4]](diffhunk://#diff-a17b44c76aaac53d1f164a2bb9440a5531659f4355e7ccfabdadff8dc8633c09L170-R171)
[[5]](diffhunk://#diff-56189fa9ae1df51716b50d34d7fe56bfe67a330e8ac2c6b0de7b958db6817ed5R83-R98)
### Workflow and Documentation Updates
* Updated example Docker commands in the CI workflow for consistency and
clarity.
[[1]](diffhunk://#diff-a1a3cb9bdeb5541d148091d973cf266aa3b317e6415a86630e816cbe27cf8b9cL57-R57)
[[2]](diffhunk://#diff-a1a3cb9bdeb5541d148091d973cf266aa3b317e6415a86630e816cbe27cf8b9cL78-R78)
[[3]](diffhunk://#diff-a1a3cb9bdeb5541d148091d973cf266aa3b317e6415a86630e816cbe27cf8b9cL92-R92)
[[4]](diffhunk://#diff-a1a3cb9bdeb5541d148091d973cf266aa3b317e6415a86630e816cbe27cf8b9cL106-R106)
[[5]](diffhunk://#diff-a1a3cb9bdeb5541d148091d973cf266aa3b317e6415a86630e816cbe27cf8b9cL153-R153)
[[6]](diffhunk://#diff-a1a3cb9bdeb5541d148091d973cf266aa3b317e6415a86630e816cbe27cf8b9cL164-R164)
* Removed outdated note about `Replace` support from the SQLite driver
documentation.
These changes improve the consistency, reliability, and developer
experience when performing upsert operations across different database
backends.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Lance Add <1196661499@qq.com>
Enhance the Chinese documentation by adding a new README file and
updating existing database driver instructions with the latest `go get`
commands. Additionally, provide Chinese explanations for the `gf`
command documentation.
fix https://github.com/gogf/gf/issues/4533
优化run命令使得只在文件有写入事件时才触发reload:
gf run 的文件监控逻辑之前会对所有文件系统事件做出响应,包括非内容修改的事件(如文件access
time变化),这会导致开发过程中不必要的频繁重载。本次修改在文件监控回调中增加了event.IsWrite()的判断,确保只有在文件内容被实际写入时才触发重载逻辑,优化了开发体验。
Add "*" and "?" to tableEx for "gf gen dao".
The "*" will match none or some char. And the "?" only match one char.
Co-authored-by: hailaz <739476267@qq.com>
Let it can support such as "Array(UInt256)", "Array(FixedString(25))".
Now we can typeMap as:
"array(uint256)": []big.Int
"array(fixedstring(25))": [25]string
"array(fixedstring)": []string
"array": []any
Now it will first match more precise rules. So it will match
array(uint256) and array(fixedstring(25)) first. Then the
"array(fixedstring)", the last is "array"
fix: disable specific staticcheck rules and update lint config
- Disabled staticcheck rules SA1029, SA1019, S1000, and related checks
in `.golangci.yml` to filter out unwanted linter errors.
- Updated staticcheck checks list for more precise linting control.
- Clarified configuration for easier maintenance and future updates.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: hailaz <739476267@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request standardizes the use of the Go 1.18+ `any` type alias
instead of `interface{}` throughout the codebase. The change improves
code readability and aligns with modern Go best practices. The update
touches many files, including core data structures, code generation
templates, logging utilities, and test data, ensuring consistency across
all usages.
**Type alias migration to `any`:**
* Replaced all instances of `interface{}` with `any` in core data
structures such as `garray` and in generated model structs (e.g.,
`TableUser`, `User1`, `User2`) to modernize type usage.
[[1]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L31-R31)
[[2]](diffhunk://#diff-6c19859cb32c7516ea95ddc8f8235460818eb2f24d2204308e0d9e1b19e7d90fL15-R19)
[[3]](diffhunk://#diff-a15ba2f5e830b4833c47b902515a4f9e5a4f83a3707698f3229b307ec3776b41L15-R18)
[[4]](diffhunk://#diff-52e0837e84d49221d1b810d88fdf78221f36cffcd664fb42f8aba49a79b974dcL15-R19)
[[5]](diffhunk://#diff-11c3457d1a23a4ca6ecd00d6b856289774936b6a708384cf03aff164044e7546L15-R19)
[[6]](diffhunk://#diff-2cff9cf8e6a0cc34087326d8c8149c3bbaf74c76fdbdf5a73daed13cc04249e1L15-R19)
* Updated function signatures, method parameters, and return types from
`interface{}` to `any` in various parts of the codebase, including code
generation, service logic, and logging utilities (e.g., `mlog`).
[[1]](diffhunk://#diff-175edfeea54490b8fe4e18ffcbea5835efaf8f0b8acf623359073987cae7eb76L48-R55)
[[2]](diffhunk://#diff-2b1953fb78cf3593d8c2c7d911e95b65fd0b847c30ed0b4d167d16fe6d781235L54-R74)
[[3]](diffhunk://#diff-e001b7a4b63603b9b14f00de78a4d570bb76c5f57d856a24643f071032e12356L66-R73)
[[4]](diffhunk://#diff-5582954e8a9983988dc8854ad82067fb2ac6269b988e07357ad8db1dfec5f1a0L39-R41)
[[5]](diffhunk://#diff-c5d51d56f487779a2b6207c7ad26c7a20bbadcc846ce094fe60ab4cabff58c51L107-R107)
[[6]](diffhunk://#diff-f96e6a9fdb416eb1804ceaba1fe0ac637bff22c43837f8bb849c2366ce72d4a1L116-R121)
[[7]](diffhunk://#diff-f94c83a1b08ae060d9346f4a6031fc4a7b9a0b894e02d9afaa09018b6598eac0L112-R112)
[[8]](diffhunk://#diff-748b11dbe8828dd4c040ec23cae0b8fe57ecf0a2d1b7694ea39102294e633c64L36-R36)
[[9]](diffhunk://#diff-748b11dbe8828dd4c040ec23cae0b8fe57ecf0a2d1b7694ea39102294e633c64L74-R74)
[[10]](diffhunk://#diff-748b11dbe8828dd4c040ec23cae0b8fe57ecf0a2d1b7694ea39102294e633c64L96-R96)
**Generated code and templates:**
* Adjusted generated files and code generation templates to output `any`
instead of `interface{}` for relevant struct fields and function
signatures, ensuring that new code generation aligns with the updated
convention.
[[1]](diffhunk://#diff-6c19859cb32c7516ea95ddc8f8235460818eb2f24d2204308e0d9e1b19e7d90fL15-R19)
[[2]](diffhunk://#diff-a15ba2f5e830b4833c47b902515a4f9e5a4f83a3707698f3229b307ec3776b41L15-R18)
[[3]](diffhunk://#diff-52e0837e84d49221d1b810d88fdf78221f36cffcd664fb42f8aba49a79b974dcL15-R19)
[[4]](diffhunk://#diff-11c3457d1a23a4ca6ecd00d6b856289774936b6a708384cf03aff164044e7546L15-R19)
[[5]](diffhunk://#diff-2cff9cf8e6a0cc34087326d8c8149c3bbaf74c76fdbdf5a73daed13cc04249e1L15-R19)
[[6]](diffhunk://#diff-175edfeea54490b8fe4e18ffcbea5835efaf8f0b8acf623359073987cae7eb76L48-R55)
[[7]](diffhunk://#diff-e001b7a4b63603b9b14f00de78a4d570bb76c5f57d856a24643f071032e12356L66-R73)
[[8]](diffhunk://#diff-5582954e8a9983988dc8854ad82067fb2ac6269b988e07357ad8db1dfec5f1a0L39-R41)
**Container and utility updates:**
* Refactored the `garray` container implementation and related
constructors/methods to use `[]any` instead of `[]interface{}`, along
with corresponding function signatures.
[[1]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L31-R31)
[[2]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L52-R52)
[[3]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L62-R62)
[[4]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L73-R86)
[[5]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L96-R97)
[[6]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L107-R114)
[[7]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L124-R124)
[[8]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L135-R143)
[[9]](diffhunk://#diff-3a1259e160a4dfa5fe49dfe739fbdb986c0d0a2220a709882ea48d3ae1b8f911L167-R167)
These changes collectively modernize the codebase and prepare it for
future Go developments by using the idiomatic `any` type.
fix bug: could not load time location: "unknown time zone Asia/Shanghai"
The bug will appear when I use gf in windows to do "gf gen dao" for
clickhouse.