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

[Question] Does gjson not implement the scan assignment interface of sql? #2895

Closed
shuqingzai opened this issue Aug 24, 2023 · 6 comments
Closed
Labels
feature help wanted planned This issue/proposal is planned into our next steps.

Comments

@shuqingzai
Copy link

我在阅读 gjson 源码时,发现并没有实现 database/sql 相关扫描赋值接口,导致我在设置值是,报错,是否可以实现这些常用的接口呢?

1. What version of Go and system type/arch are you using?

#-> % go version
go version go1.21.0 darwin/amd64

2. What version of GoFrame are you using?

#-> % gf version
GoFrame CLI Tool v2.5.2, https://goframe.org
GoFrame Version: v2.5.2 in current go.mod
CLI Installed At: /Users/shuqingzai/Code/go/bin/gf
CLI Built Detail:
  Go Version:  go1.20.6
  GF Version:  v2.5.2
  Git Commit:  2023-08-18 09:57:25 cf299273c499aafb5d19829809dfb6b8ef280c12
  Build Time:  2023-08-18 16:23:18

3. Can this issue be re-produced with the latest release?

是的

4. What did you do?

5. What did you expect to see?

6. What did you see instead?

@Issues-translate-bot Issues-translate-bot changed the title [Question] gjson 是否没有实现 sql 的扫描赋值接口? [Question] Does gjson not implement the scan assignment interface of sql? Aug 24, 2023
@gqcn
Copy link
Member

gqcn commented Oct 9, 2023

@shuqingzai 这个建议好,欢迎一起来共建吧。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@shuqingzai This is a good suggestion. You are welcome to join us in building it together.

@gqcn gqcn added feature help wanted planned This issue/proposal is planned into our next steps. labels Oct 9, 2023
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Hello @shuqingzai. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @shuqingzai。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

@chen-mou
Copy link

这个似乎没办法实现因为,gjson这个结构体已经存在名字叫Scan的方法但是参数与Scanner接口中的Scan不同,但是golang并不支持方法的重写,所以想要实现相关功能可以自己声明一个结构体并嵌入gjson来实现相关功能

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This seems impossible to implement because the gjson structure already has a method named Scan, but the parameters are different from Scan in the Scanner interface. However, golang does not support method rewriting, so if you want to implement related functions, you can declare a structure yourself. And embed gjson to implement related functions

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This seems impossible to implement because the gjson structure already has a method named Scan, but the parameters are different from Scan in the Scanner interface. However, golang does not support method rewriting, so if you want to implement related functions, you can declare a structure yourself. body and embed gjson to implement related functions

@chen-mou This is our current approach, but there will be problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted planned This issue/proposal is planned into our next steps.
Projects
None yet
Development

No branches or pull requests

4 participants