MCPcopy Create free account
hub / github.com/go-pg/pg / UpdateNotZero

Method UpdateNotZero

orm/query.go:1134–1136  ·  view source on GitHub ↗

Update updates the model omitting fields with zero values such as: - empty string, - 0, - zero time, - empty map or slice, - byte array with all zeroes, - nil ptr, - types with method `IsZero() == true`.

(scan ...interface{})

Source from the content-addressed store, hash-verified

1132// - nil ptr,
1133// - types with method `IsZero() == true`.
1134func (q *Query) UpdateNotZero(scan ...interface{}) (Result, error) {
1135 return q.update(scan, true)
1136}
1137
1138func (q *Query) update(values []interface{}, omitZero bool) (Result, error) {
1139 if q.stickyErr != nil {

Calls 1

updateMethod · 0.95

Tested by 2