go gorm多字段唯一索引

type TgUser struct {
	global.GVA_MODEL
	TelegramId    string `json:"telegram_id" form:"telegram_id" gorm:"column:telegram_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  若-飞  阅读(1)  评论(0编辑  收藏  举报