Value overwrites model value for the column in INSERT and UPDATE queries.
(column string, value string, params ...interface{})
| 442 | |
| 443 | // Value overwrites model value for the column in INSERT and UPDATE queries. |
| 444 | func (q *Query) Value(column string, value string, params ...interface{}) *Query { |
| 445 | if !q.hasTableModel() { |
| 446 | q.err(errModelNil) |
| 447 | return q |
| 448 | } |
| 449 | |
| 450 | table := q.tableModel.Table() |
| 451 | if _, ok := table.FieldsMap[column]; ok { |
| 452 | if q.modelValues == nil { |
| 453 | q.modelValues = make(map[string]*SafeQueryAppender) |
| 454 | } |
| 455 | q.modelValues[column] = SafeQuery(value, params...) |
| 456 | } else { |
| 457 | q.extraValues = append(q.extraValues, &columnValue{ |
| 458 | column: column, |
| 459 | value: SafeQuery(value, params...), |
| 460 | }) |
| 461 | } |
| 462 | |
| 463 | return q |
| 464 | } |
| 465 | |
| 466 | func (q *Query) Where(condition string, params ...interface{}) *Query { |
| 467 | q.addWhere(&condAppender{ |
nothing calls this directly
no test coverage detected