Your Question
CREATE TABLE customers (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
custinfo JSON,
INDEX zips( (CAST(custinfo->'$.zipcode' AS UNSIGNED ARRAY)) )
)
https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-multi-valued
how i can create mysql8 Multi-Valued Indexes in gorm?
The document you expected this should be explained
Expected answer
Comment From: keyvangholami
Creating MySQL 8 Multi-Valued Indexes is a specific feature that not be directly supported by GORM. However, you can still achieve this by using raw SQL queries in GORM.
Comment From: yimingsir
Creating MySQL 8 Multi-Valued Indexes is a specific feature that not be directly supported by GORM. However, you can still achieve this by using raw SQL queries in GORM.
any plan to add this feature?
Comment From: yimingsir
type Notification struct {
gorm.BaseModel
AlertID uint64 `gorm:"column:alert_id;index:idx_notification_alert_id" json:"alert_id"`
Users StringList `gorm:"column:users;type:json;index:idx_notification_users,expression:(CAST(users->'$' AS CHAR(256) ARRAY))" json:"users"`
}
i use gorm index expression to add multi-valued indexes successfully, example as above code. thanks for your reply. i close this question.