// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.

package dao

import (
	"context"
	"database/sql"

	"gorm.io/gorm"

	"gorm.io/gen"

	"gorm.io/plugin/dbresolver"
)

var (
	Q                      = new(Query)
	Activities             *activities
	ActivityCategories     *activityCategories
	ActivityDrawEffects    *activityDrawEffects
	ActivityDrawLogs       *activityDrawLogs
	ActivityDrawReceipts   *activityDrawReceipts
	ActivityIssues         *activityIssues
	ActivityRewardSettings *activityRewardSettings
	Admin                  *admin
	Banner                 *banner
	Channels               *channels
	IssuePositionClaims    *issuePositionClaims
	LogOperation           *logOperation
	LogRequest             *logRequest
	MatchingCardTypes      *matchingCardTypes
	MenuActions            *menuActions
	Menus                  *menus
	OpsShippingStats       *opsShippingStats
	OrderCoupons           *orderCoupons
	OrderItems             *orderItems
	Orders                 *orders
	PaymentBillDiff        *paymentBillDiff
	PaymentBills           *paymentBills
	PaymentNotifyEvents    *paymentNotifyEvents
	PaymentPreorders       *paymentPreorders
	PaymentRefunds         *paymentRefunds
	PaymentTransactions    *paymentTransactions
	ProductCategories      *productCategories
	Products               *products
	RoleActions            *roleActions
	RoleMenus              *roleMenus
	RoleUsers              *roleUsers
	Roles                  *roles
	ShippingRecords        *shippingRecords
	SystemConfigs          *systemConfigs
	SystemCoupons          *systemCoupons
	SystemItemCards        *systemItemCards
	SystemTitleEffects     *systemTitleEffects
	SystemTitles           *systemTitles
	TaskCenterTaskRewards  *taskCenterTaskRewards
	TaskCenterTaskTiers    *taskCenterTaskTiers
	TaskCenterTasks        *taskCenterTasks
	UserAddresses          *userAddresses
	UserCoupons            *userCoupons
	UserInventory          *userInventory
	UserInventoryTransfers *userInventoryTransfers
	UserInvites            *userInvites
	UserItemCards          *userItemCards
	UserPoints             *userPoints
	UserPointsLedger       *userPointsLedger
	UserTitleEffectClaims  *userTitleEffectClaims
	UserTitles             *userTitles
	Users                  *users
)

func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
	*Q = *Use(db, opts...)
	Activities = &Q.Activities
	ActivityCategories = &Q.ActivityCategories
	ActivityDrawEffects = &Q.ActivityDrawEffects
	ActivityDrawLogs = &Q.ActivityDrawLogs
	ActivityDrawReceipts = &Q.ActivityDrawReceipts
	ActivityIssues = &Q.ActivityIssues
	ActivityRewardSettings = &Q.ActivityRewardSettings
	Admin = &Q.Admin
	Banner = &Q.Banner
	Channels = &Q.Channels
	IssuePositionClaims = &Q.IssuePositionClaims
	LogOperation = &Q.LogOperation
	LogRequest = &Q.LogRequest
	MatchingCardTypes = &Q.MatchingCardTypes
	MenuActions = &Q.MenuActions
	Menus = &Q.Menus
	OpsShippingStats = &Q.OpsShippingStats
	OrderCoupons = &Q.OrderCoupons
	OrderItems = &Q.OrderItems
	Orders = &Q.Orders
	PaymentBillDiff = &Q.PaymentBillDiff
	PaymentBills = &Q.PaymentBills
	PaymentNotifyEvents = &Q.PaymentNotifyEvents
	PaymentPreorders = &Q.PaymentPreorders
	PaymentRefunds = &Q.PaymentRefunds
	PaymentTransactions = &Q.PaymentTransactions
	ProductCategories = &Q.ProductCategories
	Products = &Q.Products
	RoleActions = &Q.RoleActions
	RoleMenus = &Q.RoleMenus
	RoleUsers = &Q.RoleUsers
	Roles = &Q.Roles
	ShippingRecords = &Q.ShippingRecords
	SystemConfigs = &Q.SystemConfigs
	SystemCoupons = &Q.SystemCoupons
	SystemItemCards = &Q.SystemItemCards
	SystemTitleEffects = &Q.SystemTitleEffects
	SystemTitles = &Q.SystemTitles
	TaskCenterTaskRewards = &Q.TaskCenterTaskRewards
	TaskCenterTaskTiers = &Q.TaskCenterTaskTiers
	TaskCenterTasks = &Q.TaskCenterTasks
	UserAddresses = &Q.UserAddresses
	UserCoupons = &Q.UserCoupons
	UserInventory = &Q.UserInventory
	UserInventoryTransfers = &Q.UserInventoryTransfers
	UserInvites = &Q.UserInvites
	UserItemCards = &Q.UserItemCards
	UserPoints = &Q.UserPoints
	UserPointsLedger = &Q.UserPointsLedger
	UserTitleEffectClaims = &Q.UserTitleEffectClaims
	UserTitles = &Q.UserTitles
	Users = &Q.Users
}

func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
	return &Query{
		db:                     db,
		Activities:             newActivities(db, opts...),
		ActivityCategories:     newActivityCategories(db, opts...),
		ActivityDrawEffects:    newActivityDrawEffects(db, opts...),
		ActivityDrawLogs:       newActivityDrawLogs(db, opts...),
		ActivityDrawReceipts:   newActivityDrawReceipts(db, opts...),
		ActivityIssues:         newActivityIssues(db, opts...),
		ActivityRewardSettings: newActivityRewardSettings(db, opts...),
		Admin:                  newAdmin(db, opts...),
		Banner:                 newBanner(db, opts...),
		Channels:               newChannels(db, opts...),
		IssuePositionClaims:    newIssuePositionClaims(db, opts...),
		LogOperation:           newLogOperation(db, opts...),
		LogRequest:             newLogRequest(db, opts...),
		MatchingCardTypes:      newMatchingCardTypes(db, opts...),
		MenuActions:            newMenuActions(db, opts...),
		Menus:                  newMenus(db, opts...),
		OpsShippingStats:       newOpsShippingStats(db, opts...),
		OrderCoupons:           newOrderCoupons(db, opts...),
		OrderItems:             newOrderItems(db, opts...),
		Orders:                 newOrders(db, opts...),
		PaymentBillDiff:        newPaymentBillDiff(db, opts...),
		PaymentBills:           newPaymentBills(db, opts...),
		PaymentNotifyEvents:    newPaymentNotifyEvents(db, opts...),
		PaymentPreorders:       newPaymentPreorders(db, opts...),
		PaymentRefunds:         newPaymentRefunds(db, opts...),
		PaymentTransactions:    newPaymentTransactions(db, opts...),
		ProductCategories:      newProductCategories(db, opts...),
		Products:               newProducts(db, opts...),
		RoleActions:            newRoleActions(db, opts...),
		RoleMenus:              newRoleMenus(db, opts...),
		RoleUsers:              newRoleUsers(db, opts...),
		Roles:                  newRoles(db, opts...),
		ShippingRecords:        newShippingRecords(db, opts...),
		SystemConfigs:          newSystemConfigs(db, opts...),
		SystemCoupons:          newSystemCoupons(db, opts...),
		SystemItemCards:        newSystemItemCards(db, opts...),
		SystemTitleEffects:     newSystemTitleEffects(db, opts...),
		SystemTitles:           newSystemTitles(db, opts...),
		TaskCenterTaskRewards:  newTaskCenterTaskRewards(db, opts...),
		TaskCenterTaskTiers:    newTaskCenterTaskTiers(db, opts...),
		TaskCenterTasks:        newTaskCenterTasks(db, opts...),
		UserAddresses:          newUserAddresses(db, opts...),
		UserCoupons:            newUserCoupons(db, opts...),
		UserInventory:          newUserInventory(db, opts...),
		UserInventoryTransfers: newUserInventoryTransfers(db, opts...),
		UserInvites:            newUserInvites(db, opts...),
		UserItemCards:          newUserItemCards(db, opts...),
		UserPoints:             newUserPoints(db, opts...),
		UserPointsLedger:       newUserPointsLedger(db, opts...),
		UserTitleEffectClaims:  newUserTitleEffectClaims(db, opts...),
		UserTitles:             newUserTitles(db, opts...),
		Users:                  newUsers(db, opts...),
	}
}

type Query struct {
	db *gorm.DB

	Activities             activities
	ActivityCategories     activityCategories
	ActivityDrawEffects    activityDrawEffects
	ActivityDrawLogs       activityDrawLogs
	ActivityDrawReceipts   activityDrawReceipts
	ActivityIssues         activityIssues
	ActivityRewardSettings activityRewardSettings
	Admin                  admin
	Banner                 banner
	Channels               channels
	IssuePositionClaims    issuePositionClaims
	LogOperation           logOperation
	LogRequest             logRequest
	MatchingCardTypes      matchingCardTypes
	MenuActions            menuActions
	Menus                  menus
	OpsShippingStats       opsShippingStats
	OrderCoupons           orderCoupons
	OrderItems             orderItems
	Orders                 orders
	PaymentBillDiff        paymentBillDiff
	PaymentBills           paymentBills
	PaymentNotifyEvents    paymentNotifyEvents
	PaymentPreorders       paymentPreorders
	PaymentRefunds         paymentRefunds
	PaymentTransactions    paymentTransactions
	ProductCategories      productCategories
	Products               products
	RoleActions            roleActions
	RoleMenus              roleMenus
	RoleUsers              roleUsers
	Roles                  roles
	ShippingRecords        shippingRecords
	SystemConfigs          systemConfigs
	SystemCoupons          systemCoupons
	SystemItemCards        systemItemCards
	SystemTitleEffects     systemTitleEffects
	SystemTitles           systemTitles
	TaskCenterTaskRewards  taskCenterTaskRewards
	TaskCenterTaskTiers    taskCenterTaskTiers
	TaskCenterTasks        taskCenterTasks
	UserAddresses          userAddresses
	UserCoupons            userCoupons
	UserInventory          userInventory
	UserInventoryTransfers userInventoryTransfers
	UserInvites            userInvites
	UserItemCards          userItemCards
	UserPoints             userPoints
	UserPointsLedger       userPointsLedger
	UserTitleEffectClaims  userTitleEffectClaims
	UserTitles             userTitles
	Users                  users
}

func (q *Query) Available() bool { return q.db != nil }

func (q *Query) clone(db *gorm.DB) *Query {
	return &Query{
		db:                     db,
		Activities:             q.Activities.clone(db),
		ActivityCategories:     q.ActivityCategories.clone(db),
		ActivityDrawEffects:    q.ActivityDrawEffects.clone(db),
		ActivityDrawLogs:       q.ActivityDrawLogs.clone(db),
		ActivityDrawReceipts:   q.ActivityDrawReceipts.clone(db),
		ActivityIssues:         q.ActivityIssues.clone(db),
		ActivityRewardSettings: q.ActivityRewardSettings.clone(db),
		Admin:                  q.Admin.clone(db),
		Banner:                 q.Banner.clone(db),
		Channels:               q.Channels.clone(db),
		IssuePositionClaims:    q.IssuePositionClaims.clone(db),
		LogOperation:           q.LogOperation.clone(db),
		LogRequest:             q.LogRequest.clone(db),
		MatchingCardTypes:      q.MatchingCardTypes.clone(db),
		MenuActions:            q.MenuActions.clone(db),
		Menus:                  q.Menus.clone(db),
		OpsShippingStats:       q.OpsShippingStats.clone(db),
		OrderCoupons:           q.OrderCoupons.clone(db),
		OrderItems:             q.OrderItems.clone(db),
		Orders:                 q.Orders.clone(db),
		PaymentBillDiff:        q.PaymentBillDiff.clone(db),
		PaymentBills:           q.PaymentBills.clone(db),
		PaymentNotifyEvents:    q.PaymentNotifyEvents.clone(db),
		PaymentPreorders:       q.PaymentPreorders.clone(db),
		PaymentRefunds:         q.PaymentRefunds.clone(db),
		PaymentTransactions:    q.PaymentTransactions.clone(db),
		ProductCategories:      q.ProductCategories.clone(db),
		Products:               q.Products.clone(db),
		RoleActions:            q.RoleActions.clone(db),
		RoleMenus:              q.RoleMenus.clone(db),
		RoleUsers:              q.RoleUsers.clone(db),
		Roles:                  q.Roles.clone(db),
		ShippingRecords:        q.ShippingRecords.clone(db),
		SystemConfigs:          q.SystemConfigs.clone(db),
		SystemCoupons:          q.SystemCoupons.clone(db),
		SystemItemCards:        q.SystemItemCards.clone(db),
		SystemTitleEffects:     q.SystemTitleEffects.clone(db),
		SystemTitles:           q.SystemTitles.clone(db),
		TaskCenterTaskRewards:  q.TaskCenterTaskRewards.clone(db),
		TaskCenterTaskTiers:    q.TaskCenterTaskTiers.clone(db),
		TaskCenterTasks:        q.TaskCenterTasks.clone(db),
		UserAddresses:          q.UserAddresses.clone(db),
		UserCoupons:            q.UserCoupons.clone(db),
		UserInventory:          q.UserInventory.clone(db),
		UserInventoryTransfers: q.UserInventoryTransfers.clone(db),
		UserInvites:            q.UserInvites.clone(db),
		UserItemCards:          q.UserItemCards.clone(db),
		UserPoints:             q.UserPoints.clone(db),
		UserPointsLedger:       q.UserPointsLedger.clone(db),
		UserTitleEffectClaims:  q.UserTitleEffectClaims.clone(db),
		UserTitles:             q.UserTitles.clone(db),
		Users:                  q.Users.clone(db),
	}
}

func (q *Query) ReadDB() *Query {
	return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
}

func (q *Query) WriteDB() *Query {
	return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
}

func (q *Query) ReplaceDB(db *gorm.DB) *Query {
	return &Query{
		db:                     db,
		Activities:             q.Activities.replaceDB(db),
		ActivityCategories:     q.ActivityCategories.replaceDB(db),
		ActivityDrawEffects:    q.ActivityDrawEffects.replaceDB(db),
		ActivityDrawLogs:       q.ActivityDrawLogs.replaceDB(db),
		ActivityDrawReceipts:   q.ActivityDrawReceipts.replaceDB(db),
		ActivityIssues:         q.ActivityIssues.replaceDB(db),
		ActivityRewardSettings: q.ActivityRewardSettings.replaceDB(db),
		Admin:                  q.Admin.replaceDB(db),
		Banner:                 q.Banner.replaceDB(db),
		Channels:               q.Channels.replaceDB(db),
		IssuePositionClaims:    q.IssuePositionClaims.replaceDB(db),
		LogOperation:           q.LogOperation.replaceDB(db),
		LogRequest:             q.LogRequest.replaceDB(db),
		MatchingCardTypes:      q.MatchingCardTypes.replaceDB(db),
		MenuActions:            q.MenuActions.replaceDB(db),
		Menus:                  q.Menus.replaceDB(db),
		OpsShippingStats:       q.OpsShippingStats.replaceDB(db),
		OrderCoupons:           q.OrderCoupons.replaceDB(db),
		OrderItems:             q.OrderItems.replaceDB(db),
		Orders:                 q.Orders.replaceDB(db),
		PaymentBillDiff:        q.PaymentBillDiff.replaceDB(db),
		PaymentBills:           q.PaymentBills.replaceDB(db),
		PaymentNotifyEvents:    q.PaymentNotifyEvents.replaceDB(db),
		PaymentPreorders:       q.PaymentPreorders.replaceDB(db),
		PaymentRefunds:         q.PaymentRefunds.replaceDB(db),
		PaymentTransactions:    q.PaymentTransactions.replaceDB(db),
		ProductCategories:      q.ProductCategories.replaceDB(db),
		Products:               q.Products.replaceDB(db),
		RoleActions:            q.RoleActions.replaceDB(db),
		RoleMenus:              q.RoleMenus.replaceDB(db),
		RoleUsers:              q.RoleUsers.replaceDB(db),
		Roles:                  q.Roles.replaceDB(db),
		ShippingRecords:        q.ShippingRecords.replaceDB(db),
		SystemConfigs:          q.SystemConfigs.replaceDB(db),
		SystemCoupons:          q.SystemCoupons.replaceDB(db),
		SystemItemCards:        q.SystemItemCards.replaceDB(db),
		SystemTitleEffects:     q.SystemTitleEffects.replaceDB(db),
		SystemTitles:           q.SystemTitles.replaceDB(db),
		TaskCenterTaskRewards:  q.TaskCenterTaskRewards.replaceDB(db),
		TaskCenterTaskTiers:    q.TaskCenterTaskTiers.replaceDB(db),
		TaskCenterTasks:        q.TaskCenterTasks.replaceDB(db),
		UserAddresses:          q.UserAddresses.replaceDB(db),
		UserCoupons:            q.UserCoupons.replaceDB(db),
		UserInventory:          q.UserInventory.replaceDB(db),
		UserInventoryTransfers: q.UserInventoryTransfers.replaceDB(db),
		UserInvites:            q.UserInvites.replaceDB(db),
		UserItemCards:          q.UserItemCards.replaceDB(db),
		UserPoints:             q.UserPoints.replaceDB(db),
		UserPointsLedger:       q.UserPointsLedger.replaceDB(db),
		UserTitleEffectClaims:  q.UserTitleEffectClaims.replaceDB(db),
		UserTitles:             q.UserTitles.replaceDB(db),
		Users:                  q.Users.replaceDB(db),
	}
}

type queryCtx struct {
	Activities             *activitiesDo
	ActivityCategories     *activityCategoriesDo
	ActivityDrawEffects    *activityDrawEffectsDo
	ActivityDrawLogs       *activityDrawLogsDo
	ActivityDrawReceipts   *activityDrawReceiptsDo
	ActivityIssues         *activityIssuesDo
	ActivityRewardSettings *activityRewardSettingsDo
	Admin                  *adminDo
	Banner                 *bannerDo
	Channels               *channelsDo
	IssuePositionClaims    *issuePositionClaimsDo
	LogOperation           *logOperationDo
	LogRequest             *logRequestDo
	MatchingCardTypes      *matchingCardTypesDo
	MenuActions            *menuActionsDo
	Menus                  *menusDo
	OpsShippingStats       *opsShippingStatsDo
	OrderCoupons           *orderCouponsDo
	OrderItems             *orderItemsDo
	Orders                 *ordersDo
	PaymentBillDiff        *paymentBillDiffDo
	PaymentBills           *paymentBillsDo
	PaymentNotifyEvents    *paymentNotifyEventsDo
	PaymentPreorders       *paymentPreordersDo
	PaymentRefunds         *paymentRefundsDo
	PaymentTransactions    *paymentTransactionsDo
	ProductCategories      *productCategoriesDo
	Products               *productsDo
	RoleActions            *roleActionsDo
	RoleMenus              *roleMenusDo
	RoleUsers              *roleUsersDo
	Roles                  *rolesDo
	ShippingRecords        *shippingRecordsDo
	SystemConfigs          *systemConfigsDo
	SystemCoupons          *systemCouponsDo
	SystemItemCards        *systemItemCardsDo
	SystemTitleEffects     *systemTitleEffectsDo
	SystemTitles           *systemTitlesDo
	TaskCenterTaskRewards  *taskCenterTaskRewardsDo
	TaskCenterTaskTiers    *taskCenterTaskTiersDo
	TaskCenterTasks        *taskCenterTasksDo
	UserAddresses          *userAddressesDo
	UserCoupons            *userCouponsDo
	UserInventory          *userInventoryDo
	UserInventoryTransfers *userInventoryTransfersDo
	UserInvites            *userInvitesDo
	UserItemCards          *userItemCardsDo
	UserPoints             *userPointsDo
	UserPointsLedger       *userPointsLedgerDo
	UserTitleEffectClaims  *userTitleEffectClaimsDo
	UserTitles             *userTitlesDo
	Users                  *usersDo
}

func (q *Query) WithContext(ctx context.Context) *queryCtx {
	return &queryCtx{
		Activities:             q.Activities.WithContext(ctx),
		ActivityCategories:     q.ActivityCategories.WithContext(ctx),
		ActivityDrawEffects:    q.ActivityDrawEffects.WithContext(ctx),
		ActivityDrawLogs:       q.ActivityDrawLogs.WithContext(ctx),
		ActivityDrawReceipts:   q.ActivityDrawReceipts.WithContext(ctx),
		ActivityIssues:         q.ActivityIssues.WithContext(ctx),
		ActivityRewardSettings: q.ActivityRewardSettings.WithContext(ctx),
		Admin:                  q.Admin.WithContext(ctx),
		Banner:                 q.Banner.WithContext(ctx),
		Channels:               q.Channels.WithContext(ctx),
		IssuePositionClaims:    q.IssuePositionClaims.WithContext(ctx),
		LogOperation:           q.LogOperation.WithContext(ctx),
		LogRequest:             q.LogRequest.WithContext(ctx),
		MatchingCardTypes:      q.MatchingCardTypes.WithContext(ctx),
		MenuActions:            q.MenuActions.WithContext(ctx),
		Menus:                  q.Menus.WithContext(ctx),
		OpsShippingStats:       q.OpsShippingStats.WithContext(ctx),
		OrderCoupons:           q.OrderCoupons.WithContext(ctx),
		OrderItems:             q.OrderItems.WithContext(ctx),
		Orders:                 q.Orders.WithContext(ctx),
		PaymentBillDiff:        q.PaymentBillDiff.WithContext(ctx),
		PaymentBills:           q.PaymentBills.WithContext(ctx),
		PaymentNotifyEvents:    q.PaymentNotifyEvents.WithContext(ctx),
		PaymentPreorders:       q.PaymentPreorders.WithContext(ctx),
		PaymentRefunds:         q.PaymentRefunds.WithContext(ctx),
		PaymentTransactions:    q.PaymentTransactions.WithContext(ctx),
		ProductCategories:      q.ProductCategories.WithContext(ctx),
		Products:               q.Products.WithContext(ctx),
		RoleActions:            q.RoleActions.WithContext(ctx),
		RoleMenus:              q.RoleMenus.WithContext(ctx),
		RoleUsers:              q.RoleUsers.WithContext(ctx),
		Roles:                  q.Roles.WithContext(ctx),
		ShippingRecords:        q.ShippingRecords.WithContext(ctx),
		SystemConfigs:          q.SystemConfigs.WithContext(ctx),
		SystemCoupons:          q.SystemCoupons.WithContext(ctx),
		SystemItemCards:        q.SystemItemCards.WithContext(ctx),
		SystemTitleEffects:     q.SystemTitleEffects.WithContext(ctx),
		SystemTitles:           q.SystemTitles.WithContext(ctx),
		TaskCenterTaskRewards:  q.TaskCenterTaskRewards.WithContext(ctx),
		TaskCenterTaskTiers:    q.TaskCenterTaskTiers.WithContext(ctx),
		TaskCenterTasks:        q.TaskCenterTasks.WithContext(ctx),
		UserAddresses:          q.UserAddresses.WithContext(ctx),
		UserCoupons:            q.UserCoupons.WithContext(ctx),
		UserInventory:          q.UserInventory.WithContext(ctx),
		UserInventoryTransfers: q.UserInventoryTransfers.WithContext(ctx),
		UserInvites:            q.UserInvites.WithContext(ctx),
		UserItemCards:          q.UserItemCards.WithContext(ctx),
		UserPoints:             q.UserPoints.WithContext(ctx),
		UserPointsLedger:       q.UserPointsLedger.WithContext(ctx),
		UserTitleEffectClaims:  q.UserTitleEffectClaims.WithContext(ctx),
		UserTitles:             q.UserTitles.WithContext(ctx),
		Users:                  q.Users.WithContext(ctx),
	}
}

func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
	return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
}

func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
	tx := q.db.Begin(opts...)
	return &QueryTx{Query: q.clone(tx), Error: tx.Error}
}

type QueryTx struct {
	*Query
	Error error
}

func (q *QueryTx) Commit() error {
	return q.db.Commit().Error
}

func (q *QueryTx) Rollback() error {
	return q.db.Rollback().Error
}

func (q *QueryTx) SavePoint(name string) error {
	return q.db.SavePoint(name).Error
}

func (q *QueryTx) RollbackTo(name string) error {
	return q.db.RollbackTo(name).Error
}
