MCPcopy
hub / github.com/uber/aresdb / IndexOfStr

Function IndexOfStr

utils/slices.go:19–26  ·  view source on GitHub ↗

IndexOfStr finds the index of a target string inside a slice of strings, return -1 if not found

(strs []string, target string)

Source from the content-addressed store, hash-verified

17// IndexOfStr finds the index of a target string inside a slice of strings,
18// return -1 if not found
19func IndexOfStr(strs []string, target string) int {
20 for id, str := range strs {
21 if str == target {
22 return id
23 }
24 }
25 return -1
26}
27
28// IndexOfInt finds the index of a target int inside a slice of ints,
29// return -1 if not found

Callers 5

checkPrimaryKeysFunction · 0.92
applyTableListMethod · 0.92
CreateTableMethod · 0.92
DeleteTableMethod · 0.92
slices_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected