NewUpdateSpec creates a new node update spec.
(table string, columns []string, id ...*FieldSpec)
| 790 | |
| 791 | // NewUpdateSpec creates a new node update spec. |
| 792 | func NewUpdateSpec(table string, columns []string, id ...*FieldSpec) *UpdateSpec { |
| 793 | spec := &UpdateSpec{ |
| 794 | Node: &NodeSpec{Table: table, Columns: columns}, |
| 795 | } |
| 796 | switch { |
| 797 | case len(id) == 1: |
| 798 | spec.Node.ID = id[0] |
| 799 | case len(id) > 1: |
| 800 | spec.Node.CompositeID = id |
| 801 | } |
| 802 | return spec |
| 803 | } |
| 804 | |
| 805 | // AddModifier adds a new statement modifier to the spec. |
| 806 | func (u *UpdateSpec) AddModifier(m func(*sql.UpdateBuilder)) { |
no outgoing calls
no test coverage detected
searching dependent graphs…