MCPcopy
hub / github.com/jmoiron/sqlx / bindMapArgs

Function bindMapArgs

named.go:197–208  ·  view source on GitHub ↗

like bindArgs, but for maps.

(names []string, arg map[string]interface{})

Source from the content-addressed store, hash-verified

195
196// like bindArgs, but for maps.
197func bindMapArgs(names []string, arg map[string]interface{}) ([]interface{}, error) {
198 arglist := make([]interface{}, 0, len(names))
199
200 for _, name := range names {
201 val, ok := arg[name]
202 if !ok {
203 return arglist, fmt.Errorf("could not find name %s in %#v", name, arg)
204 }
205 arglist = append(arglist, val)
206 }
207 return arglist, nil
208}
209
210// bindStruct binds a named parameter query with fields from a struct argument.
211// The rules for binding field names to parameter names follow the same

Callers 2

bindAnyArgsFunction · 0.85
bindMapFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected