MCPcopy Create free account
hub / github.com/micro/go-micro / buildUpdate

Function buildUpdate

model/postgres/postgres.go:315–330  ·  view source on GitHub ↗
(schema *model.Schema, fields map[string]any)

Source from the content-addressed store, hash-verified

313}
314
315func buildUpdate(schema *model.Schema, fields map[string]any) (string, []any) {
316 var setClauses []string
317 var values []any
318 i := 1
319 for _, f := range schema.Fields {
320 if f.IsKey {
321 continue
322 }
323 if v, ok := fields[f.Column]; ok {
324 setClauses = append(setClauses, fmt.Sprintf("%s = $%d", quoteIdent(f.Column), i))
325 values = append(values, v)
326 i++
327 }
328 }
329 return strings.Join(setClauses, ", "), values
330}
331
332func buildWhere(filters []model.Filter, startParam int) (string, []any, int) {
333 var clauses []string

Callers 1

UpdateMethod · 0.70

Calls 1

quoteIdentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…