go gorm多字段唯一索引

type TgUser struct {
	global.GVA_MODEL
	TGId    string `json:"TG_id" form:"TG_id" gorm:"column:TG_id;unique;"`
	Username      string `json:"username" form:"username" gorm:"column:username;uniqueIndex:userWalletAddress"`
	WalletAddress string `json:"wallet_address" form:"wallet_address" gorm:"column:wallet_address;uniqueIndex:userWalletAddress;size:64;"`

格式:

  uniqueIndex:多字段唯一索引key名称

posted @ 2024-07-22 18:06  若-飞  阅读(346)  评论(0)    收藏  举报