Skip to content
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

优化serializer #5

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

优化serializer #5

wants to merge 4 commits into from

Conversation

kwinH
Copy link

@kwinH kwinH commented Jul 30, 2024

No description provided.

@titrxw
Copy link
Member

titrxw commented Aug 2, 2024

为什么要单独把serializer分出来? 建议如果需要进行格式化的话还是要设定一个具体的类型比较好

@kwinH
Copy link
Author

kwinH commented Aug 6, 2024

serializer

我发现定义了serializer,但type名不包含Option,居然就不生效,这样是不合适的。

@titrxw
Copy link
Member

titrxw commented Aug 7, 2024

可以讲下你的使用场景? 或者提供下示例

@kwinH
Copy link
Author

kwinH commented Aug 8, 2024

relation:  
  - table: user_list
    column:
      dialogue_style:
        serializer: json
        type: "[]Style"

model目录下已经定义了Style,serializer: json是无效的

@titrxw
Copy link
Member

titrxw commented Aug 9, 2024

如果type配置成[]Style, 一是扩展性不好,二是还需要配置这个Style需要导入的包,反而会比较麻烦。

建议使用 type DialogueStyle []Style{} 或者 type DialogueStyle struct{ List []Style }, 这种方式后续扩展性比较好,配置也简单

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.

2 participants