Commit Graph

68 Commits

Author SHA1 Message Date
ee24da4e72 refactor: interface{} to any and reflect.Ptr to reflect.Pointer (#4395)
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.
2025-08-28 16:53:19 +08:00
13bc192e36 feat(database/gdb): add sharding feature for schema and table (#4014) 2024-12-09 23:12:20 +08:00
7cbc9e8533 test(os/gcache): fix unit testing occasionally failed due to too short expration duration set (#3842) 2024-10-08 13:06:11 +08:00
4ee5bf5c45 fix(database/gdb): #3754 FieldsEx feature conflicts with soft time feature in soft time fields updating (#3773) 2024-09-13 16:50:38 +08:00
2ccbb02c71 fix: #3613 ignore automatic handling for creating/updating time if it has been specified (#3615) 2024-06-12 21:41:44 +08:00
509cc47d3f enhance: add Save operation support for pgsql #3053 (#3324) 2024-03-04 20:17:43 +08:00
2acdf4bb47 add field type detection for soft time field like created_at/updated_at/deleted_at to support unix timestamp or bool deleting table field (#3293) 2024-02-06 10:21:23 +08:00
85c5b7f19e fix issue #2594 (#3303) 2024-02-05 20:40:03 +08:00
44819b135e fix issue #3204 (#3212) 2023-12-18 20:19:18 +08:00
7c1be3eb63 improve data converting for DB.DoInsert/DoUpdate (#2830) 2023-08-07 21:03:56 +08:00
740dfa58a6 add sharding feature on Model for package gdb (#2732) 2023-07-04 14:42:41 +08:00
9620b15ea1 fix length check issue (#2725) 2023-07-04 09:49:09 +08:00
e721124b6c support microseconds resolution for created_at/updated_at/deleted_at (#2512) 2023-03-20 09:57:37 +08:00
b69e0ff9f7 fix issue #2338 (#2444) 2023-02-14 09:45:29 +08:00
1793bf0863 add golangci feature to guarantee codes quality (#2229) 2022-11-01 20:12:21 +08:00
3430cf1f17 improve data converting for package gdb, drivers/pgsql 2022-05-18 11:55:09 +08:00
534abb7f17 improve hook feature for package gdb 2022-05-09 14:22:28 +08:00
ebad3eb93e error meesage update for package gdb; remove default batch number for batch insert statement for package gdb 2022-04-18 20:28:00 +08:00
372bae4799 fix issue in missing first result column when in select cache scenario 2022-03-31 15:42:12 +08:00
09ba1bf1fb imrove context handling for package gdb 2022-03-24 17:51:49 +08:00
6dacdd60dc add sharding feature for package gdb 2022-03-21 21:17:48 +08:00
87ccc27ee4 sharding feature develop 2022-03-21 14:26:56 +08:00
dccfc1c8cd add hook feature for model of package gdb 2022-03-14 23:47:55 +08:00
bbab9f3934 rename DoGetAll to DoSelect 2022-03-14 19:36:43 +08:00
d8d9996464 fix issue #1662 2022-03-11 10:24:42 +08:00
7e5301c845 expose insert option constants for package gdb 2022-01-21 17:31:48 +08:00
9345eb5e94 dto -> do for package gdb 2022-01-17 21:10:58 +08:00
b79e4a3ab7 add interface function ConvertDataForRecord for gdb.DB 2021-12-23 22:00:28 +08:00
19c9f0a488 add DTO feature for package gdb 2021-12-15 00:01:59 +08:00
732664a1ff files renaming for package gdb 2021-11-17 22:01:17 +08:00
c6efb5ee3b [feature] improve code range map 2021-11-16 17:21:13 +08:00
634cacd435 merge develop 2021-11-15 19:15:58 +08:00
da7ddd43f5 improve field filtering for list type parameters of function Data for ForDao models 2021-11-15 17:39:23 +08:00
98e5fb1542 improve field filtering for list type parameters of function Data for ForDao models 2021-11-15 17:27:35 +08:00
f99b037c60 improve field filtering for list type parameters of function Data for ForDao models 2021-11-15 17:06:04 +08:00
be03b3cdda Improved import, by group improt. 2021-11-13 23:23:55 +08:00
77a0f59cd3 add automatic adding OmitNil option for data and where filtering if given struct name is defined like 'xxxForDao' 2021-11-02 09:55:37 +08:00
8ef4f68215 add IgnoreEmptySliceWhere feature for package gdb; add OriginValueAndKind/OriginTypeAndKind functions for package internal/utils 2021-10-28 23:18:23 +08:00
1bc0635f8b version 2 2021-10-11 21:41:56 +08:00
01a3dd1eb0 add function gerror.HasStack; rename all api* interfaces to i* 2021-09-17 19:26:56 +08:00
73d2b7ed06 fix issue #1387 2021-08-30 22:26:02 +08:00
abc8e62d58 add package gcode and improve error implements for package gerror 2021-08-24 21:18:59 +08:00
9cd944fd77 improve time maintaining feature for package gdb 2021-08-07 11:01:15 +08:00
0ddacdd7e2 add error code for components 2021-07-20 23:02:02 +08:00
2606ad83ac add OnDuplicate/OnDuplicateEx feature for package gdb 2021-06-16 21:51:44 +08:00
d450de8e0d add OnDuplicate/OnDuplicateEx feature for package gdb 2021-06-16 21:44:31 +08:00
e68e7a3224 remove Batch*/DoBatchInsert functions for package gdb 2021-06-08 20:32:34 +08:00
8aa7f08350 improve DB interface for package gdb 2021-06-04 09:54:19 +08:00
4e41d8aff8 improve context and nested transaction feature for package gdb 2021-05-21 13:25:53 +08:00
bd84b97614 add more Where*/Min/Max/Avg/Sum/CountColumn/Increment/Decrement/OrderAsc/OrderDesc/OrderRandom functions and associated unit testing cases for package gdb 2021-05-02 12:17:06 +08:00