github.com/wfusion/gofusion@v1.1.14/db/softdelete/types.go (about)

     1  package softdelete
     2  
     3  import (
     4  	"gorm.io/gorm/clause"
     5  
     6  	"github.com/wfusion/gofusion/common/utils"
     7  )
     8  
     9  const (
    10  	defaultEnabledFlag   = "soft_delete_enabled"
    11  	statusEnabledFlag    = "soft_delete_enabled_status"
    12  	timestampEnabledFlag = "soft_delete_enabled_timestamp"
    13  	deletedAtEnabledFlag = "soft_delete_enabled_deletedat"
    14  )
    15  
    16  func IsClausesWithSoftDelete(clauses map[string]clause.Clause) (withSoftDelete bool) {
    17  	utils.IfAny(
    18  		func() (ok bool) { _, withSoftDelete = clauses[defaultEnabledFlag]; return withSoftDelete },
    19  		func() (ok bool) { _, withSoftDelete = clauses[statusEnabledFlag]; return withSoftDelete },
    20  		func() (ok bool) { _, withSoftDelete = clauses[timestampEnabledFlag]; return withSoftDelete },
    21  		func() (ok bool) { _, withSoftDelete = clauses[deletedAtEnabledFlag]; return withSoftDelete },
    22  	)
    23  	return
    24  }