log.go 949 字节
package dao

import (
	pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
)

func ChangeStepLogOwner(ptr *pgTransaction.TransactionContext, from int, to int) error {
	sql := "update metadata.logs set source_id = ? where source_id=? and log_type=?"
	_, err := ptr.PgTx.Exec(sql, to, from, domain.VerifiedStepLog)
	return err
}

func LogDirectDelete(ptr *pgTransaction.TransactionContext, sourceId int, logType domain.LogType) error {
	sql := "delete from metadata.logs where source_id = ? and log_type = ?"
	_, err := ptr.PgTx.Exec(sql, sourceId, logType)
	return err
}

//func LogSoftDelete(ptr *pgTransaction.TransactionContext, sourceIds []int, logType domain.LogType) error {
//	sql := "update metadata.logs set deleted_at = now() where source_id in(?) and log_type = ?"
//	_, err := ptr.PgTx.Exec(sql, pg.In(sourceIds), logType)
//	return err
//}