MCPcopy Create free account
hub / github.com/cel-expr/cel-go / matchSlot

Function matchSlot

ext/bindings.go:350–364  ·  view source on GitHub ↗
(name string, slotCount int)

Source from the content-addressed store, hash-verified

348}
349
350func matchSlot(name string, slotCount int) (int, bool) {
351 if idx, found := strings.CutPrefix(name, indexPrefix); found {
352 idx, err := strconv.Atoi(idx)
353 // Return not found if the index is not numeric
354 if err != nil {
355 return -1, false
356 }
357 // Return not found if the index is not a valid slot
358 if idx < 0 || idx >= slotCount {
359 return -1, false
360 }
361 return idx, true
362 }
363 return -1, false
364}
365
366var (
367 indexPrefix = "@index"

Callers 2

ResolveNameMethod · 0.85
ResolveNameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected