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

Method appendMapSet

orm/update.go:170–193  ·  view source on GitHub ↗
(b []byte, m map[string]interface{})

Source from the content-addressed store, hash-verified

168}
169
170func (q *UpdateQuery) appendMapSet(b []byte, m map[string]interface{}) []byte {
171 keys := make([]string, 0, len(m))
172
173 for k := range m {
174 keys = append(keys, k)
175 }
176 sort.Strings(keys)
177
178 for i, k := range keys {
179 if i > 0 {
180 b = append(b, ", "...)
181 }
182
183 b = types.AppendIdent(b, k, 1)
184 b = append(b, " = "...)
185 if q.placeholder {
186 b = append(b, '?')
187 } else {
188 b = types.Append(b, m[k], 1)
189 }
190 }
191
192 return b
193}
194
195func (q *UpdateQuery) appendSetStruct(fmter QueryFormatter, b []byte, strct reflect.Value) ([]byte, error) {
196 fields, err := q.q.getFields()

Callers 1

mustAppendSetMethod · 0.95

Calls 2

AppendIdentFunction · 0.92
AppendFunction · 0.92

Tested by

no test coverage detected