go-gorm / datatypes

GORM Customized Data Types Collection
https://gorm.io/docs/data_types.html
MIT License
714 stars 108 forks source link

feature: add Mysql&Postgres Json Like #225

Closed wave2way closed 11 months ago

wave2way commented 1 year ago

What did this pull request do?

Add Likes function on JSONQueryExpression

User Case Description

` type UserWithJSON struct { gorm.Model Name string Attributes datatypes.JSON }

DB.Create(&User{ Name: "json-1", Attributes: datatypes.JSON([]byte({"name": "jinzhu", "age": 18, "tags": ["tag1", "tag2"], "orgs": {"orga": "orga"}})), }

var result UserWithJSON DB.First(&result, datatypes.JSONQuery("attributes").Likes("%jin%", "name")) `

wave2way commented 1 year ago

why the test container start failed with "Error: One or more containers failed to start." ?