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

数字数组查询不对劲 #176

Open
liyuan1125 opened this issue Dec 22, 2022 · 2 comments
Open

数字数组查询不对劲 #176

liyuan1125 opened this issue Dec 22, 2022 · 2 comments
Assignees

Comments

@liyuan1125
Copy link

数据是这样的

["330100", "330200", "330300", "330400", "330500", "330600", "330700", "330800", "330900", "331000", "331100"]

db.Table("table_name").Where(datatypes.JSONQuery("area_code").HasKey("330100")).Find(&rows)

错误:

Invalid JSON path expression. The error is around character position 8.

@Jeffreeey
Copy link
Contributor

可以试试这么查询,db.Table("table_name").Where(datatypes.JSONArrayQuery("area_code").Contains("330100")).Find(&rows)

@tiptok
Copy link

tiptok commented Sep 20, 2023

same problem
how to query this in postgresql ?

select * from table where area_code::jsonb @>'[330100]'

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

No branches or pull requests

4 participants