MCPcopy Index your code
hub / github.com/micro/go-micro / buildInsert

Function buildInsert

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

Source from the content-addressed store, hash-verified

285}
286
287func buildInsert(schema *model.Schema, fields map[string]any) (string, string, []any) {
288 var cols []string
289 var placeholders []string
290 var values []any
291 for _, f := range schema.Fields {
292 if v, ok := fields[f.Column]; ok {
293 cols = append(cols, fmt.Sprintf("%q", f.Column))
294 placeholders = append(placeholders, "?")
295 values = append(values, v)
296 }
297 }
298 return strings.Join(cols, ", "), strings.Join(placeholders, ", "), values
299}
300
301func buildUpdate(schema *model.Schema, fields map[string]any) (string, []any) {
302 var setClauses []string

Callers 1

CreateMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…