We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
DB.Create(&User{ Name: "json-1", Attributes: datatypes.JSON([]byte({"name": "jinzhu", "age": 18, "tags": ["tag1", "tag2"], "orgs": {"orga": "orga"}})), }
{"name": "jinzhu", "age": 18, "tags": ["tag1", "tag2"], "orgs": {"orga": "orga"}}
查询tags里,是否有tag1,怎么做呢?谢谢!
The text was updated successfully, but these errors were encountered:
the same question here. how to query a tag is in json array
https://www.postgresql.org/docs/current/datatype-json.html
-- Find documents in which the key "tags" contains key or array element "qui" SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc -> 'tags' ? 'qui';
ping @jinzhu
Sorry, something went wrong.
and more
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
or my project using
result = common.NewDb. Raw("select * from gs_article where gs_article.tag_ids @> ? LIMIT ? OFFSET ? ", tagId, rpp, offset). Find(&blogDataList)
jinzhu
No branches or pull requests
DB.Create(&User{
Name: "json-1",
Attributes: datatypes.JSON([]byte(
{"name": "jinzhu", "age": 18, "tags": ["tag1", "tag2"], "orgs": {"orga": "orga"}}
)),}
查询tags里,是否有tag1,怎么做呢?谢谢!
The text was updated successfully, but these errors were encountered: