MCPcopy
hub / github.com/ent/ent / Add

Method Add

dialect/sql/builder.go:561–572  ·  view source on GitHub ↗

Add adds a numeric value to the given column. Note that, calling Set(c) after Add(c) will erase previous calls with c from the builder.

(column string, v any)

Source from the content-addressed store, hash-verified

559// Add adds a numeric value to the given column. Note that, calling Set(c)
560// after Add(c) will erase previous calls with c from the builder.
561func (u *UpdateBuilder) Add(column string, v any) *UpdateBuilder {
562 u.columns = append(u.columns, column)
563 u.values = append(u.values, ExprFunc(func(b *Builder) {
564 b.WriteString("COALESCE")
565 b.Wrap(func(b *Builder) {
566 b.Ident(Table(u.table).C(column)).Comma().WriteByte('0')
567 })
568 b.WriteString(" + ")
569 b.Arg(v)
570 }))
571 return u
572}
573
574// SetNull sets a column as null value.
575func (u *UpdateBuilder) SetNull(column string) *UpdateBuilder {

Callers

nothing calls this directly

Calls 9

ExprFuncFunction · 0.85
WriteStringMethod · 0.80
WrapMethod · 0.80
WriteByteMethod · 0.80
CommaMethod · 0.80
IdentMethod · 0.80
ArgMethod · 0.80
TableFunction · 0.70
CMethod · 0.65

Tested by

no test coverage detected