MCPcopy
hub / github.com/go-gorm/gorm / checkMissingWhereConditions

Function checkMissingWhereConditions

callbacks/helper.go:109–123  ·  view source on GitHub ↗
(db *gorm.DB)

Source from the content-addressed store, hash-verified

107}
108
109func checkMissingWhereConditions(db *gorm.DB) {
110 if !db.AllowGlobalUpdate && db.Error == nil {
111 where, withCondition := db.Statement.Clauses["WHERE"]
112 if withCondition {
113 if _, withSoftDelete := db.Statement.Clauses["soft_delete_enabled"]; withSoftDelete {
114 whereClause, _ := where.Expression.(clause.Where)
115 withCondition = len(whereClause.Exprs) > 1
116 }
117 }
118 if !withCondition {
119 db.AddError(gorm.ErrMissingWhereClause)
120 }
121 return
122 }
123}
124
125type visitMap = map[reflect.Value]bool
126

Callers 2

UpdateFunction · 0.85
DeleteFunction · 0.85

Calls 1

AddErrorMethod · 0.65

Tested by

no test coverage detected