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

Method Value

orm/query.go:444–464  ·  view source on GitHub ↗

Value overwrites model value for the column in INSERT and UPDATE queries.

(column string, value string, params ...interface{})

Source from the content-addressed store, hash-verified

442
443// Value overwrites model value for the column in INSERT and UPDATE queries.
444func (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
466func (q *Query) Where(condition string, params ...interface{}) *Query {
467 q.addWhere(&condAppender{

Callers

nothing calls this directly

Calls 4

hasTableModelMethod · 0.95
errMethod · 0.95
SafeQueryFunction · 0.70
TableMethod · 0.65

Tested by

no test coverage detected