MCPcopy Create free account
hub / github.com/apache/devlake / UpdateColumns

Method UpdateColumns

backend/impls/dalgorm/dalgorm.go:290–303  ·  view source on GitHub ↗

UpdateColumns allows you to update multiple columns of multiple records

(entityOrTable interface{}, set []dal.DalSet, clauses ...dal.Clause)

Source from the content-addressed store, hash-verified

288
289// UpdateColumns allows you to update multiple columns of multiple records
290func (d *Dalgorm) UpdateColumns(entityOrTable interface{}, set []dal.DalSet, clauses ...dal.Clause) errors.Error {
291 d.unwrapDynamic(&entityOrTable, &clauses)
292 updatesSet := make(map[string]interface{})
293
294 for _, s := range set {
295 if expr, ok := s.Value.(dal.DalClause); ok {
296 s.Value = gorm.Expr(expr.Expr, transformParams(expr.Params)...)
297 }
298 updatesSet[s.ColumnName] = s.Value
299 }
300
301 clauses = append(clauses, dal.From(entityOrTable))
302 return d.convertGormError(buildTx(d.db, clauses).Updates(updatesSet).Error)
303}
304
305// UpdateAllColumn updated all Columns of entity
306func (d *Dalgorm) UpdateAllColumn(entity interface{}, clauses ...dal.Clause) errors.Error {

Callers

nothing calls this directly

Calls 5

unwrapDynamicMethod · 0.95
convertGormErrorMethod · 0.95
transformParamsFunction · 0.85
buildTxFunction · 0.85
FromMethod · 0.65

Tested by

no test coverage detected