-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
database/gdb: fix #2119 #3559
Open
wln32
wants to merge
5
commits into
gogf:master
Choose a base branch
from
wln32:fix/orm-with
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
database/gdb: fix #2119 #3559
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
SET NAMES utf8mb4; | ||
SET FOREIGN_KEY_CHECKS = 0; | ||
|
||
-- ---------------------------- | ||
-- Table structure for sys_role | ||
-- ---------------------------- | ||
DROP TABLE IF EXISTS `sys_role`; | ||
CREATE TABLE `sys_role` ( | ||
`id` int(0) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '||s', | ||
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '角色名称||s,r', | ||
`code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '角色 code||s,r', | ||
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述信息|text', | ||
`weight` int(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序||r|min:0#发布状态不能小于 0', | ||
`status_id` int(0) UNSIGNED NOT NULL DEFAULT 1 COMMENT '发布状态|hasOne|f:status,fk:id', | ||
`created_at` datetime(0) NULL DEFAULT NULL, | ||
`updated_at` datetime(0) NULL DEFAULT NULL, | ||
PRIMARY KEY (`id`) USING BTREE, | ||
INDEX `code`(`code`) USING BTREE | ||
) ENGINE = InnoDB AUTO_INCREMENT = 1091 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统角色表' ROW_FORMAT = Compact; | ||
|
||
-- ---------------------------- | ||
-- Records of sys_role | ||
-- ---------------------------- | ||
INSERT INTO `sys_role` VALUES (1, '开发人员', 'developer', '123123', 900, 2, '2022-09-03 21:25:03', '2022-09-09 23:35:23'); | ||
INSERT INTO `sys_role` VALUES (2, '管理员', 'admin', '', 800, 1, '2022-09-03 21:25:03', '2022-09-09 23:00:17'); | ||
INSERT INTO `sys_role` VALUES (3, '运营', 'operator', '', 700, 1, '2022-09-03 21:25:03', '2022-09-03 21:25:03'); | ||
INSERT INTO `sys_role` VALUES (4, '客服', 'service', '', 600, 1, '2022-09-03 21:25:03', '2022-09-03 21:25:03'); | ||
INSERT INTO `sys_role` VALUES (5, '收银', 'account', '', 500, 1, '2022-09-03 21:25:03', '2022-09-03 21:25:03'); | ||
|
||
-- ---------------------------- | ||
-- Table structure for sys_status | ||
-- ---------------------------- | ||
DROP TABLE IF EXISTS `sys_status`; | ||
CREATE TABLE `sys_status` ( | ||
`id` int(0) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`en` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '英文名称', | ||
`cn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '中文名称', | ||
`weight` int(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重', | ||
PRIMARY KEY (`id`) USING BTREE | ||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发布状态' ROW_FORMAT = Dynamic; | ||
|
||
-- ---------------------------- | ||
-- Records of sys_status | ||
-- ---------------------------- | ||
INSERT INTO `sys_status` VALUES (1, 'on line', '上线', 900); | ||
INSERT INTO `sys_status` VALUES (2, 'undecided', '未决定', 800); | ||
INSERT INTO `sys_status` VALUES (3, 'off line', '下线', 700); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不能直接改这个基础方法,根据
![image](https://private-user-images.githubusercontent.com/26347176/328545128-8fd93c9e-bb4b-48ee-b944-ce3c4b52e370.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMDI5NjMsIm5iZiI6MTcxOTEwMjY2MywicGF0aCI6Ii8yNjM0NzE3Ni8zMjg1NDUxMjgtOGZkOTNjOWUtYmI0Yi00OGVlLWI5NDQtY2UzYzRiNTJlMzcwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDAwMzEwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIzN2JjODY2MDRkY2QwY2M5YjIxNjA2NmJjOWFlNjRhYWQ4M2MyZGM5N2Q0ZWNhOTkzN2E1ZDY1NDhmZGEwZDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5MoDRkoZJs8pI4xw05b2xlhfTmHxNwPPq6hk3JIdVOE)
issue
描述,似乎是这里没有获取到匿名结构体的Field
。这里有一个RecursiveOption
的控制你可以研究一下呢?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gqcn 这里获取的是最外层结构体,
![123456](https://private-user-images.githubusercontent.com/49137144/328550505-39e4c116-3ffb-476a-b2b2-dddc51cb764d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMDI5NjMsIm5iZiI6MTcxOTEwMjY2MywicGF0aCI6Ii80OTEzNzE0NC8zMjg1NTA1MDUtMzllNGMxMTYtM2ZmYi00NzZhLWIyYjItZGRkYzUxY2I3NjRkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDAwMzEwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTczMzA1NTdjOWI1N2E4YzFjMTkwNjc5Njc5N2MyNGRiMjBjNDAxMDEwOTM2OTEzOTk2MzI5MDVjNGY2OTA1MDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.U14AbSIRwvH8EXZXC68Q_1FhFfrxr_wd5Sm2TxUB5yY)
所以那里是无法获取到Status结构体的字段
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
倒是可以使用gstructs包的其他方法来解析结构体获取所有的字段,当时我看那个方法只有这里使用了,所以就做了改动。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那截图红框部分没有达到预期,预期是如果内嵌的结构体在没有
tag
时嵌套结构体的属性会作为Fields
返回。可以研究下这个方法为什么失败了呢?