(ctx context.Context)
| 1138 | } |
| 1139 | |
| 1140 | func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) { |
| 1141 | if err := nuo.check(); err != nil { |
| 1142 | return _node, err |
| 1143 | } |
| 1144 | _spec := sqlgraph.NewUpdateSpec(node.Table, node.Columns, sqlgraph.NewFieldSpec(node.FieldID, field.TypeString)) |
| 1145 | id, ok := nuo.mutation.ID() |
| 1146 | if !ok { |
| 1147 | return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Node.id" for update`)} |
| 1148 | } |
| 1149 | _spec.Node.ID.Value = id |
| 1150 | if fields := nuo.fields; len(fields) > 0 { |
| 1151 | _spec.Node.Columns = make([]string, 0, len(fields)) |
| 1152 | _spec.Node.Columns = append(_spec.Node.Columns, node.FieldID) |
| 1153 | for _, f := range fields { |
| 1154 | if !node.ValidColumn(f) { |
| 1155 | return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} |
| 1156 | } |
| 1157 | if f != node.FieldID { |
| 1158 | _spec.Node.Columns = append(_spec.Node.Columns, f) |
| 1159 | } |
| 1160 | } |
| 1161 | } |
| 1162 | if ps := nuo.mutation.predicates; len(ps) > 0 { |
| 1163 | _spec.Predicate = func(selector *sql.Selector) { |
| 1164 | for i := range ps { |
| 1165 | ps[i](selector) |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | if value, ok := nuo.mutation.UpdateTime(); ok { |
| 1170 | _spec.SetField(node.FieldUpdateTime, field.TypeTime, value) |
| 1171 | } |
| 1172 | if value, ok := nuo.mutation.NormalizedID(); ok { |
| 1173 | _spec.SetField(node.FieldNormalizedID, field.TypeString, value) |
| 1174 | } |
| 1175 | if value, ok := nuo.mutation.Name(); ok { |
| 1176 | _spec.SetField(node.FieldName, field.TypeString, value) |
| 1177 | } |
| 1178 | if value, ok := nuo.mutation.Description(); ok { |
| 1179 | _spec.SetField(node.FieldDescription, field.TypeString, value) |
| 1180 | } |
| 1181 | if nuo.mutation.DescriptionCleared() { |
| 1182 | _spec.ClearField(node.FieldDescription, field.TypeString) |
| 1183 | } |
| 1184 | if value, ok := nuo.mutation.Category(); ok { |
| 1185 | _spec.SetField(node.FieldCategory, field.TypeString, value) |
| 1186 | } |
| 1187 | if nuo.mutation.CategoryCleared() { |
| 1188 | _spec.ClearField(node.FieldCategory, field.TypeString) |
| 1189 | } |
| 1190 | if value, ok := nuo.mutation.Author(); ok { |
| 1191 | _spec.SetField(node.FieldAuthor, field.TypeString, value) |
| 1192 | } |
| 1193 | if nuo.mutation.AuthorCleared() { |
| 1194 | _spec.ClearField(node.FieldAuthor, field.TypeString) |
| 1195 | } |
| 1196 | if value, ok := nuo.mutation.License(); ok { |
| 1197 | _spec.SetField(node.FieldLicense, field.TypeString, value) |
nothing calls this directly
no test coverage detected