MCPcopy
hub / github.com/Masterminds/squirrel / SetMap

Method SetMap

update.go:230–243  ·  view source on GitHub ↗

SetMap is a convenience method which calls .Set for each key/value pair in clauses.

(clauses map[string]interface{})

Source from the content-addressed store, hash-verified

228
229// SetMap is a convenience method which calls .Set for each key/value pair in clauses.
230func (b UpdateBuilder) SetMap(clauses map[string]interface{}) UpdateBuilder {
231 keys := make([]string, len(clauses))
232 i := 0
233 for key := range clauses {
234 keys[i] = key
235 i++
236 }
237 sort.Strings(keys)
238 for _, key := range keys {
239 val, _ := clauses[key]
240 b = b.Set(key, val)
241 }
242 return b
243}
244
245// From adds FROM clause to the query
246// FROM is valid construct in postgresql only.

Callers 4

TestInsertBuilderSetMapFunction · 0.45
squirrel_test.goFile · 0.45
TestUpdateBuilderToSqlFunction · 0.45

Calls 1

SetMethod · 0.95

Tested by 3

TestInsertBuilderSetMapFunction · 0.36
TestUpdateBuilderToSqlFunction · 0.36