| 171 | } |
| 172 | |
| 173 | func (sc *SettingCreate) createSpec() (*Setting, *sqlgraph.CreateSpec) { |
| 174 | var ( |
| 175 | _node = &Setting{config: sc.config} |
| 176 | _spec = sqlgraph.NewCreateSpec(setting.Table, sqlgraph.NewFieldSpec(setting.FieldID, field.TypeInt)) |
| 177 | ) |
| 178 | |
| 179 | if id, ok := sc.mutation.ID(); ok { |
| 180 | _node.ID = id |
| 181 | id64 := int64(id) |
| 182 | _spec.ID.Value = id64 |
| 183 | } |
| 184 | |
| 185 | _spec.OnConflict = sc.conflict |
| 186 | if value, ok := sc.mutation.CreatedAt(); ok { |
| 187 | _spec.SetField(setting.FieldCreatedAt, field.TypeTime, value) |
| 188 | _node.CreatedAt = value |
| 189 | } |
| 190 | if value, ok := sc.mutation.UpdatedAt(); ok { |
| 191 | _spec.SetField(setting.FieldUpdatedAt, field.TypeTime, value) |
| 192 | _node.UpdatedAt = value |
| 193 | } |
| 194 | if value, ok := sc.mutation.DeletedAt(); ok { |
| 195 | _spec.SetField(setting.FieldDeletedAt, field.TypeTime, value) |
| 196 | _node.DeletedAt = &value |
| 197 | } |
| 198 | if value, ok := sc.mutation.Name(); ok { |
| 199 | _spec.SetField(setting.FieldName, field.TypeString, value) |
| 200 | _node.Name = value |
| 201 | } |
| 202 | if value, ok := sc.mutation.Value(); ok { |
| 203 | _spec.SetField(setting.FieldValue, field.TypeString, value) |
| 204 | _node.Value = value |
| 205 | } |
| 206 | return _node, _spec |
| 207 | } |
| 208 | |
| 209 | // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause |
| 210 | // of the `INSERT` statement. For example: |