userOption.go 412 Bytes
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package luckyWheel_m

import (
	"gorm.io/gorm"
	"gorm.io/gorm/clause"
)

type LuckyWheelUserOption struct {
	UserId      uint64
	GroupId     string
	LastId      uint
	SelfJoin    bool
	AutoRestart bool
}

func (uo *LuckyWheelUserOption) Save(db *gorm.DB) error {
	return db.Clauses(clause.OnConflict{
		DoUpdates: clause.AssignmentColumns([]string{"last_id", "self_join", "auto_restart"}),
	}).Create(uo).Error
}