This is how model looks:
type Board struct {
Id uint `gorm:"primaryKey;autoIncrement;unique" json:"id"`
Owner uint `json:"owner"`
Name string `json:"name"`
Contributors datatypes.JSON `gorm:"type:jsonb" json:"contributors"`
GeneratedLink string `gorm:"default:''" json:"generated_link"`
Todos datatypes.JSON `gorm:"type:jsonb" json:"todos"`
}
This is how contributors value looks in the postgresql column:
and how to make query that checks that contributors array contains for example 20?
i tried to do like this: database.DB.Where("contributors IN ?", 20).Find(&contBoards)
but got error: ERROR: syntax error at or near "$1" (SQLSTATE 42601)
Please any ideas, any options. P.S using gorm, postgresql