MCPcopy
hub / github.com/lmorg/murex / itoNotMap

Function itoNotMap

lang/define_index_objects.go:255–286  ·  view source on GitHub ↗
(p *Process, params []string, v map[K]V, marshaller func(any) ([]byte, error))

Source from the content-addressed store, hash-verified

253}
254
255func itoNotMap[K comparable, V indexValueT](p *Process, params []string, v map[K]V, marshaller func(any) ([]byte, error)) error {
256 objMap := make(map[K]any)
257 not := make(map[K]bool)
258 var key any
259
260 for _, key = range params {
261 not[key.(K)] = true
262
263 key = strings.Title(key.(string))
264 not[key.(K)] = true
265
266 key = strings.ToLower(key.(string))
267 not[key.(K)] = true
268
269 key = strings.ToUpper(key.(string))
270 not[key.(K)] = true
271 }
272
273 for s := range v {
274 if !not[s] {
275 objMap[s] = v[s]
276 }
277 }
278
279 b, err := marshaller(objMap)
280 if err != nil {
281 return err
282 }
283 p.Stdout.Writeln(b)
284
285 return nil
286}

Callers 1

itoNotFunction · 0.85

Calls 1

WritelnMethod · 0.65

Tested by

no test coverage detected