Gorm: How to define two Multiple-Column indexs with one same index?

Created on 8 Oct 2016  ·  1Comment  ·  Source: go-gorm/gorm

How to define two Multiple-Column indexs with one same index?

Such as:

type Message struct {
       Uid    int64 `gorm:"index:idx_uid_time"`
       Roomid int64 `gorm:"index:idx_roomid_time"`
       Time   int64 `gorm:"index:id_uid_time;index:idx_roomid_time"`
       Data   string
}

This don't work.
I read the source code. model_struct.go:parseTagSetting:547 use setting := map[string]string{}, this code setting[k] = strings.Join(v[1:], ":") ensure use only one index. So Time only use index:idx_roomid_time.
How can I do with that? Thanks.

Most helpful comment

gorm:"index:id_uid_time,idx_roomid_time"

>All comments

gorm:"index:id_uid_time,idx_roomid_time"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanyuen picture alanyuen  ·  3Comments

leebrooks0 picture leebrooks0  ·  3Comments

rfyiamcool picture rfyiamcool  ·  3Comments

easonlin404 picture easonlin404  ·  3Comments

bramp picture bramp  ·  3Comments